nizhikov commented on code in PR #12602:
URL: https://github.com/apache/ignite/pull/12602#discussion_r2644328632
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/SnapshotFileTree.java:
##########
@@ -380,14 +381,41 @@ public File meta() {
* This will distribute workload to all physical device on host.
*
* @param ft Node file tree.
- * @param snpDfltPath Snapshot default path.
+ * @param cfg Ignite configuration.
*/
- private Map<String, File> snapshotExtraStorages(NodeFileTree ft, String
snpDfltPath) {
+ private Map<String, File> snapshotExtraStorages(NodeFileTree ft,
IgniteConfiguration cfg) {
+ String snpDfltPath = cfg.getSnapshotPath();
+
+ DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration();
+ boolean hasExtraSnpPaths = dsCfg != null &&
dsCfg.getExtraSnapshotPaths() != null && dsCfg.getExtraSnapshotPaths().length >
0;
+
// If path provided then create snapshot inside it, only.
- // Same rule applies if absolute path to the snapshot root dir
configured.
- if (path != null || new File(snpDfltPath).isAbsolute())
+ // Same rule applies if absolute path to the snapshot root dir
configured and no extra snapshot paths.
+ if (path != null || (new File(snpDfltPath).isAbsolute() &&
!hasExtraSnpPaths))
return Collections.emptyMap();
+ if (hasExtraSnpPaths) {
+ String[] extraSnpPaths = dsCfg.getExtraSnapshotPaths();
+ String[] extraStorages = dsCfg.getExtraStoragePaths();
+
+ assert extraSnpPaths.length == extraStorages.length;
+
+ Map<String, File> snpExtraStorages = new HashMap<>();
+
+ for (int i = 0; i < extraSnpPaths.length; i++) {
+ // Extra snapshot paths configured as "root" related.
+ File snpDir = ft.resolveDirectory(Path.of(extraSnpPaths[i],
DFLT_SNAPSHOT_DIRECTORY, name, DB_DIR).toString());
+
+ // folderName can be different from local (NodeFileTree ft)
one.
+ // In case snapshot restored on smaller topology and data from
some node copied to local.
+ snpDir = new File(snpDir.getParent(), folderName());
+
+ snpExtraStorages.put(extraStorages[i], snpDir);
+ }
+
+ return snpExtraStorages;
+ }
+
Map<String, File> snpExtraStorages = new HashMap<>();
Review Comment:
Fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]