This is an automated email from the ASF dual-hosted git repository.

nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new d9bee0e4432 IGNITE-24481 Migration to snapshot file tree in tests 
(#11870)
d9bee0e4432 is described below

commit d9bee0e44322e1dbc9d956dba501477637dbc83b
Author: Nikolay <[email protected]>
AuthorDate: Fri Feb 14 13:50:46 2025 +0300

    IGNITE-24481 Migration to snapshot file tree in tests (#11870)
---
 .../cache/persistence/filename/NodeFileTree.java   |  28 ++-
 .../persistence/filename/SnapshotFileTree.java     | 220 +++++++++++++++++++++
 .../snapshot/IgniteSnapshotManager.java            |  47 +----
 .../snapshot/dump/CreateDumpFutureTask.java        |   2 +-
 .../cache/persistence/snapshot/dump/Dump.java      |   2 +-
 .../snapshot/AbstractSnapshotSelfTest.java         |  42 ++--
 .../snapshot/IgniteClusterSnapshotCheckTest.java   |  53 ++---
 .../snapshot/IgniteClusterSnapshotHandlerTest.java |  10 +-
 .../IgniteClusterSnapshotRestoreSelfTest.java      |  17 +-
 .../snapshot/IgniteClusterSnapshotSelfTest.java    |  40 ++--
 .../IgniteClusterSnapshotWalRecordTest.java        |   4 +-
 .../snapshot/IgniteSnapshotManagerSelfTest.java    |   6 +-
 .../snapshot/IncrementalSnapshotTest.java          |  22 ++-
 .../persistence/snapshot/PlainSnapshotTest.java    |  20 +-
 .../snapshot/dump/IgniteCacheDumpSelf2Test.java    |  13 +-
 .../IncrementalSnapshotCheckBeforeRestoreTest.java |  34 ++--
 .../IncrementalSnapshotRestoreTest.java            |  19 +-
 .../testframework/junits/GridAbstractTest.java     |  15 ++
 18 files changed, 383 insertions(+), 211 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/NodeFileTree.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/NodeFileTree.java
index 65761f857e9..865b9f99643 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/NodeFileTree.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/NodeFileTree.java
@@ -31,7 +31,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static java.lang.String.format;
@@ -495,6 +494,15 @@ public class NodeFileTree extends SharedFileTree {
         return ccfg.getGroupName() == null ? CACHE_DATA_FILENAME : 
(ccfg.getName() + CACHE_DATA_FILENAME);
     }
 
+    /**
+     * @param ccfg Cache configuration.
+     * @param part Partition id.
+     * @return Partition file.
+     */
+    public File partitionFile(CacheConfiguration<?, ?> ccfg, int part) {
+        return partitionFile(cacheDirName(ccfg), part);
+    }
+
     /**
      * @param cacheDirName Cache directory name.
      * @param part Partition id.
@@ -504,13 +512,21 @@ public class NodeFileTree extends SharedFileTree {
         return new File(cacheStorage(cacheDirName), partitionFileName(part));
     }
 
+    /**
+     * @param cacheDirName Cache directory name.
+     * @return Store directory for given cache.
+     */
+    public File cacheStorage(String cacheDirName) {
+        return new File(nodeStorage, cacheDirName);
+    }
+
     /**
      * @param workDir Cache work directory.
      * @param cacheDirName Cache directory name.
      * @param part Partition id.
      * @return Partition file.
      */
-    @NotNull public static File partitionFile(File workDir, String 
cacheDirName, int part) {
+    public static File partitionFile(File workDir, String cacheDirName, int 
part) {
         return new File(cacheStorage(workDir, cacheDirName), 
partitionFileName(part));
     }
 
@@ -573,14 +589,6 @@ public class NodeFileTree extends SharedFileTree {
         return f.getName().equals(CACHE_DATA_FILENAME);
     }
 
-    /**
-     * @param cacheDirName Cache directory name.
-     * @return Store directory for given cache.
-     */
-    public File cacheStorage(String cacheDirName) {
-        return new File(nodeStorage, cacheDirName);
-    }
-
     /**
      * @param isSharedGroup {@code True} if cache is sharing the same 
`underlying` cache.
      * @param cacheOrGroupName Cache name.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/SnapshotFileTree.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/SnapshotFileTree.java
new file mode 100644
index 00000000000..827d6bad177
--- /dev/null
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/filename/SnapshotFileTree.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence.filename;
+
+import java.io.File;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+import static 
org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION;
+import static 
org.apache.ignite.internal.pagemem.PageIdAllocator.MAX_PARTITION_ID;
+
+/**
+ * {@link NodeFileTree} extension with the methods required to work with 
snapshot file tree.
+ * During creation, full snapshot, creates the same file tree as regular node.
+ * But, using snapshot directory as root.
+ */
+public class SnapshotFileTree extends NodeFileTree {
+    /** File with delta pages suffix. */
+    public static final String DELTA_SUFFIX = ".delta";
+
+    /** File with delta pages index suffix. */
+    public static final String DELTA_IDX_SUFFIX = ".idx";
+
+    /** Snapshot metafile extension. */
+    public static final String SNAPSHOT_METAFILE_EXT = ".smf";
+
+    /** File name template consists of delta pages. */
+    public static final String PART_DELTA_TEMPLATE = PART_FILE_TEMPLATE + 
DELTA_SUFFIX;
+
+    /** File name template for index delta pages. */
+    public static final String INDEX_DELTA_NAME = INDEX_FILE_NAME + 
DELTA_SUFFIX;
+
+    /** Lock file for dump directory. */
+    public static final String DUMP_LOCK = "dump.lock";
+
+    /** Incremental snapshots directory name. */
+    public static final String INC_SNP_DIR = "increments";
+
+    /** Snapshot name. */
+    private final String name;
+
+    /** Snapshot path. */
+    @Nullable private final String path;
+
+    /** Consistent id for snapshot. */
+    private final String consId;
+
+    /** Node file tree relative to {@link #tempFileTree()}. */
+    private final NodeFileTree tmpFt;
+
+    /**
+     * @param loc Local node.
+     * @param name Snapshot name.
+     * @param path Optional snapshot path.
+     */
+    public SnapshotFileTree(IgniteEx loc, String name, @Nullable String path) {
+        super(root(loc.context().pdsFolderResolver().fileTree(), name, path), 
loc.context().pdsFolderResolver().fileTree().folderName());
+
+        A.notNullOrEmpty(name, "Snapshot name cannot be null or empty.");
+        A.ensure(U.alphanumericUnderscore(name), "Snapshot name must satisfy 
the following name pattern: a-zA-Z0-9_");
+
+        NodeFileTree ft = loc.context().pdsFolderResolver().fileTree();
+
+        this.name = name;
+        this.path = path;
+        this.consId = loc.localNode().consistentId().toString();
+        this.tmpFt = new NodeFileTree(new File(ft.snapshotTempRoot(), name), 
folderName());
+    }
+
+    /** @return Snapshot name. */
+    public String name() {
+        return name;
+    }
+
+    /** @return Snapshot path. */
+    @Nullable public String path() {
+        return path;
+    }
+
+    /** @return Snapshot temp file tree. */
+    public NodeFileTree tempFileTree() {
+        return tmpFt;
+    }
+
+    /**
+     * @param incIdx Increment index.
+     * @return Root directory for incremental snapshot.
+     */
+    public IncrementalSnapshotFileTree incrementalSnapshotFileTree(int incIdx) 
{
+        return new IncrementalSnapshotFileTree(
+            new File(incrementsRoot(), U.fixedLengthNumberName(incIdx, null)),
+            U.maskForFileName(folderName()),
+            incIdx
+        );
+    }
+
+    /**
+     * @param cacheDirName Cache dir name.
+     * @param partId Cache partition identifier.
+     * @return A file representation.
+     */
+    public File partDeltaFile(String cacheDirName, int partId) {
+        return new File(tmpFt.cacheStorage(cacheDirName), 
partDeltaFileName(partId));
+    }
+
+    /**
+     * @return Dump lock file.
+     */
+    public File dumpLock() {
+        return new File(nodeStorage(), DUMP_LOCK);
+    }
+
+    /**
+     * Returns root folder for incremental snapshot.
+     * For example, {@code "work/snapshots/mybackup/increments/"}.
+     *
+     * @return Local snapshot directory where snapshot files are located.
+     */
+    public File incrementsRoot() {
+        return new File(root(), INC_SNP_DIR);
+    }
+
+    /**
+     * @return Snapshot metadata file.
+     */
+    public File meta() {
+        return new File(root, snapshotMetaFileName(consId));
+    }
+
+    /**
+     * @return Temp snapshot metadata file.
+     */
+    public File tmpMeta() {
+        return new File(root, snapshotMetaFileName(consId) + TMP_SUFFIX);
+    }
+
+    /**
+     * @param partId Partition id.
+     * @return File name of delta partition pages.
+     */
+    public static String partDeltaFileName(int partId) {
+        assert partId <= MAX_PARTITION_ID || partId == INDEX_PARTITION;
+
+        return partId == INDEX_PARTITION ? INDEX_DELTA_NAME : 
String.format(PART_DELTA_TEMPLATE, partId);
+    }
+
+    /**
+     * @param consId Consistent node id.
+     * @return Snapshot metadata file name.
+     */
+    private String snapshotMetaFileName(String consId) {
+        return U.maskForFileName(consId) + SNAPSHOT_METAFILE_EXT;
+    }
+
+    /**
+     * @param ft Node file tree.
+     * @param name Snapshot name.
+     * @param path Optional snapshot path.
+     * @return Path to the snapshot root directory.
+     */
+    private static File root(NodeFileTree ft, String name, @Nullable String 
path) {
+        assert name != null : "Snapshot name cannot be empty or null.";
+
+        return path == null ? new File(ft.snapshotsRoot(), name) : new 
File(path, name);
+    }
+
+    /**
+     * Node file tree for incremental snapshots.
+     */
+    public class IncrementalSnapshotFileTree extends NodeFileTree {
+        /** Increment index. */
+        private final int idx;
+
+        /**
+         * @param root Root directory.
+         * @param folderName Folder name.
+         */
+        public IncrementalSnapshotFileTree(File root, String folderName, int 
idx) {
+            super(root, folderName);
+
+            this.idx = idx;
+        }
+
+        /**
+         * @return Increment index.
+         */
+        public int index() {
+            return idx;
+        }
+
+        /**
+         * @return Path to the meta file.
+         */
+        public File meta() {
+            return new File(root, snapshotMetaFileName(folderName()));
+        }
+
+        /** {@inheritDoc} */
+        @Override public File walSegment(long idx) {
+            return new File(wal(), U.fixedLengthNumberName(idx, 
ZIP_WAL_SEG_FILE_EXT));
+        }
+    }
+}
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
index efe7570e9e2..b24ee54cbb9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManager.java
@@ -212,12 +212,16 @@ import static 
org.apache.ignite.internal.pagemem.PageIdUtils.toDetailString;
 import static 
org.apache.ignite.internal.processors.cache.GridCacheUtils.baselineNode;
 import static 
org.apache.ignite.internal.processors.cache.GridCacheUtils.isPersistenceEnabled;
 import static 
org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.cacheDirectories;
-import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.INDEX_FILE_NAME;
-import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.PART_FILE_TEMPLATE;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.TMP_SUFFIX;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.cacheName;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.partitionFile;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.partitionFileName;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.PdsFolderResolver.DB_DEFAULT_FOLDER;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.DELTA_IDX_SUFFIX;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.DUMP_LOCK;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.INDEX_DELTA_NAME;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.PART_DELTA_TEMPLATE;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.SNAPSHOT_METAFILE_EXT;
 import static 
org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage.METASTORAGE_CACHE_ID;
 import static 
org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage.METASTORAGE_CACHE_NAME;
 import static 
org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId.getTypeByPartId;
@@ -250,18 +254,6 @@ import static 
org.apache.ignite.spi.systemview.view.SnapshotView.SNAPSHOT_SYS_VI
  */
 public class IgniteSnapshotManager extends GridCacheSharedManagerAdapter
     implements IgniteSnapshot, PartitionsExchangeAware, 
MetastorageLifecycleListener, IgniteChangeGlobalStateSupport {
-    /** File with delta pages suffix. */
-    public static final String DELTA_SUFFIX = ".delta";
-
-    /** File with delta pages index suffix. */
-    public static final String DELTA_IDX_SUFFIX = ".idx";
-
-    /** File name template consists of delta pages. */
-    public static final String PART_DELTA_TEMPLATE = PART_FILE_TEMPLATE + 
DELTA_SUFFIX;
-
-    /** File name template for index delta pages. */
-    public static final String INDEX_DELTA_NAME = INDEX_FILE_NAME + 
DELTA_SUFFIX;
-
     /** Text Reason for checkpoint to start snapshot operation. */
     public static final String CP_SNAPSHOT_REASON = "Checkpoint started to 
enforce snapshot operation: %s";
 
@@ -280,12 +272,6 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
     /** Incremental snapshot metrics prefix. */
     public static final String INCREMENTAL_SNAPSHOT_METRICS = 
metricName("snapshot", "incremental");
 
-    /** Snapshot metafile extension. */
-    public static final String SNAPSHOT_METAFILE_EXT = ".smf";
-
-    /** Snapshot temporary metafile extension. */
-    public static final String SNAPSHOT_METAFILE_TMP_EXT = ".tmp";
-
     /** Prefix for snapshot threads. */
     public static final String SNAPSHOT_RUNNER_THREAD_PREFIX = 
"snapshot-runner";
 
@@ -350,9 +336,6 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
     /** Pattern for incremental snapshot directory names. */
     public static final Pattern INC_SNP_NAME_PATTERN = 
U.fixedLengthNumberNamePattern(null);
 
-    /** Lock file for dump directory. */
-    public static final String DUMP_LOCK = "dump.lock";
-
     /**
      * Local buffer to perform copy-on-write operations with pages for {@code 
SnapshotFutureTask.PageStoreSerialWriter}s.
      * It is important to have only one buffer per thread (instead of creating 
each buffer per
@@ -802,14 +785,6 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
         });
     }
 
-    /**
-     * @param snpName Snapshot name.
-     * @return Local snapshot directory for snapshot with given name.
-     */
-    public File snapshotLocalDir(String snpName) {
-        return snapshotLocalDir(snpName, null);
-    }
-
     /**
      * @param snpName Snapshot name.
      * @param snpPath Snapshot directory path.
@@ -1433,7 +1408,7 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
 
         File snpDir = snapshotLocalDir(snpReq.snapshotName(), 
snpReq.snapshotPath());
         File tempSmf = new File(snpDir, 
snapshotMetaFileName(cctx.localNode().consistentId().toString()) +
-            SNAPSHOT_METAFILE_TMP_EXT);
+            TMP_SUFFIX);
         File smf = new File(snpDir, 
snapshotMetaFileName(cctx.localNode().consistentId().toString()));
 
         try {
@@ -1935,7 +1910,7 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
      * @param smf File denoting to snapshot metafile.
      * @return Snapshot metadata instance.
      */
-    private SnapshotMetadata readSnapshotMetadata(File smf) throws 
IgniteCheckedException, IOException {
+    public SnapshotMetadata readSnapshotMetadata(File smf) throws 
IgniteCheckedException, IOException {
         SnapshotMetadata meta = readFromFile(smf);
 
         String smfName = smf.getName().substring(0, smf.getName().length() - 
SNAPSHOT_METAFILE_EXT.length());
@@ -2552,7 +2527,6 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
 
     /**
      * @param snpName Snapshot name.
-     * @param folderName The node folder name, usually it's the same as the 
U.maskForFileName(consistentId).
      * @param grpName Cache group name.
      * @param partId Partition id.
      * @param encrKeyProvider Encryption keys provider to create encrypted IO. 
If {@code null}, no encrypted IO is used.
@@ -2560,14 +2534,13 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
      * @throws IgniteCheckedException If and error occurs.
      */
     public GridCloseableIterator<CacheDataRow> partitionRowIterator(String 
snpName,
-        String folderName,
         String grpName,
         int partId,
         @Nullable EncryptionCacheKeyProvider encrKeyProvider
     ) throws IgniteCheckedException {
         File snpDir = resolveSnapshotDir(snpName, null);
 
-        File nodePath = new File(snpDir, databaseRelativePath(folderName));
+        File nodePath = new File(snpDir, 
databaseRelativePath(ft.folderName()));
 
         if (!nodePath.exists())
             throw new IgniteCheckedException("Consistent id directory doesn't 
exists: " + nodePath.getAbsolutePath());
@@ -2587,7 +2560,7 @@ public class IgniteSnapshotManager extends 
GridCacheSharedManagerAdapter
             );
         }
 
-        File snpPart = partitionFile(new File(snapshotLocalDir(snpName, null), 
databaseRelativePath(folderName)),
+        File snpPart = partitionFile(new File(snapshotLocalDir(snpName, null), 
databaseRelativePath(ft.folderName())),
             grps.get(0).getName(), partId);
 
         int grpId = CU.cacheId(grpName);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/CreateDumpFutureTask.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/CreateDumpFutureTask.java
index f2f6f3ea96b..15c1bcd8089 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/CreateDumpFutureTask.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/CreateDumpFutureTask.java
@@ -76,7 +76,7 @@ import org.jetbrains.annotations.Nullable;
 
 import static 
org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.cacheDataFilename;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.DUMP_LOCK;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.DUMP_LOCK;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.Dump.dumpPartFileName;
 import static org.apache.ignite.internal.util.IgniteUtils.toLong;
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/Dump.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/Dump.java
index e65f12969ae..b26f7b046eb 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/Dump.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/Dump.java
@@ -67,7 +67,7 @@ import static 
org.apache.ignite.internal.processors.cache.GridLocalConfigManager
 import static 
org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.PART_FILE_PREFIX;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.ZIP_SUFFIX;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.SNAPSHOT_METAFILE_EXT;
+import static 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.SNAPSHOT_METAFILE_EXT;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.CreateDumpFutureTask.DUMP_FILE_EXT;
 import static 
org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneGridKernalContext.closeAllComponents;
 import static 
org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneGridKernalContext.startAllComponents;
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java
index 60a2c8fa834..900c29268af 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java
@@ -79,6 +79,8 @@ import 
org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.filename.SharedFileTree;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.IncrementalSnapshotFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
 import org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer;
 import org.apache.ignite.internal.processors.cache.persistence.wal.crc.FastCrc;
@@ -117,9 +119,6 @@ import static 
org.apache.ignite.events.EventType.EVTS_CLUSTER_SNAPSHOT;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.FILE_SUFFIX;
 import static 
org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage.METASTORAGE_DIR_NAME;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.CP_SNAPSHOT_REASON;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.databaseRelativePath;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.incrementalSnapshotWalsDir;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.snapshotMetaFileName;
 import static 
org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause;
 import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;
 
@@ -583,12 +582,12 @@ public abstract class AbstractSnapshotSelfTest extends 
GridCommonAbstractTest {
     }
 
     /** */
-    protected void createAndCheckSnapshot(IgniteEx ig, String snpName) throws 
IgniteCheckedException {
+    protected void createAndCheckSnapshot(IgniteEx ig, String snpName) {
         createAndCheckSnapshot(ig, snpName, null);
     }
 
     /** */
-    protected void createAndCheckSnapshot(IgniteEx ig, String snpName, String 
snpPath) throws IgniteCheckedException {
+    protected void createAndCheckSnapshot(IgniteEx ig, String snpName, String 
snpPath) {
         createAndCheckSnapshot(ig, snpName, snpPath, 0);
     }
 
@@ -598,7 +597,7 @@ public abstract class AbstractSnapshotSelfTest extends 
GridCommonAbstractTest {
         String snpName,
         String snpPath,
         long timeout
-    ) throws IgniteCheckedException {
+    ) {
         IgniteFutureImpl<Void> fut = snp(ig).createSnapshot(snpName, snpPath, 
false, onlyPrimary);
 
         if (timeout == 0)
@@ -610,7 +609,7 @@ public abstract class AbstractSnapshotSelfTest extends 
GridCommonAbstractTest {
     }
 
     /** @param snpName Snapshot name. */
-    protected void checkSnapshot(String snpName, String snpPath) throws 
IgniteCheckedException {
+    protected void checkSnapshot(String snpName, String snpPath) {
         Map<String, Map<Integer, Integer>> cachesParts = new HashMap<>();
 
         Predicate<Ignite> filter = node -> 
!node.configuration().isClientMode() &&
@@ -628,15 +627,12 @@ public abstract class AbstractSnapshotSelfTest extends 
GridCommonAbstractTest {
 
             IgniteEx node0 = (IgniteEx)node;
 
-            File nodeSnapDir = new File(
-                snp(node0).snapshotLocalDir(snpName, 
snpPath).getAbsolutePath(),
-                
databaseRelativePath(node0.context().pdsFolderResolver().resolveFolders().folderName())
-            );
+            SnapshotFileTree sft = snapshotFileTree(node0, snpName, snpPath);
 
-            if (!nodeSnapDir.exists())
+            if (!sft.nodeStorage().exists())
                 continue;
 
-            File[] cacheDirs = nodeSnapDir.listFiles(f -> f.isDirectory() && 
!f.getName().equals(METASTORAGE_DIR_NAME));
+            File[] cacheDirs = sft.nodeStorage().listFiles(f -> 
f.isDirectory() && !f.getName().equals(METASTORAGE_DIR_NAME));
 
             for (File cacheDir : cacheDirs) {
                 String name = NodeFileTree.cacheName(cacheDir);
@@ -710,10 +706,9 @@ public abstract class AbstractSnapshotSelfTest extends 
GridCommonAbstractTest {
     /**
      * @param ignite Ignite instance.
      * @return Directory name for ignite instance.
-     * @throws IgniteCheckedException If fails.
      */
-    public static String folderName(IgniteEx ignite) throws 
IgniteCheckedException {
-        return 
ignite.context().pdsFolderResolver().resolveFolders().folderName();
+    public static String folderName(IgniteEx ignite) {
+        return ignite.context().pdsFolderResolver().fileTree().folderName();
     }
 
     /**
@@ -861,10 +856,10 @@ public abstract class AbstractSnapshotSelfTest extends 
GridCommonAbstractTest {
 
     /** Checks incremental snapshot exists. */
     protected boolean checkIncremental(IgniteEx node, String snpName, String 
snpPath, int incIdx) {
-        File incSnpDir = snp(node).incrementalSnapshotLocalDir(snpName, 
snpPath, incIdx);
+        IncrementalSnapshotFileTree incSnpFt = snapshotFileTree(node, snpName, 
snpPath).incrementalSnapshotFileTree(incIdx);
 
-        if (incSnpDir.exists()) {
-            checkIncrementalSnapshotWalRecords(node, incSnpDir);
+        if (incSnpFt.root().exists()) {
+            checkIncrementalSnapshotWalRecords(node, incSnpFt);
 
             return true;
         }
@@ -873,15 +868,12 @@ public abstract class AbstractSnapshotSelfTest extends 
GridCommonAbstractTest {
     }
 
     /** */
-    private void checkIncrementalSnapshotWalRecords(IgniteEx node, File 
incSnpDir) {
+    private void checkIncrementalSnapshotWalRecords(IgniteEx node, 
IncrementalSnapshotFileTree incSnpFt) {
         try {
-            IncrementalSnapshotMetadata incSnpMeta = snp(node).readFromFile(
-                new File(incSnpDir, 
snapshotMetaFileName(node.localNode().consistentId().toString())));
-
-            File incSnpWalDir = incrementalSnapshotWalsDir(incSnpDir, 
incSnpMeta.folderName());
+            IncrementalSnapshotMetadata incSnpMeta = 
snp(node).readFromFile(incSnpFt.meta());
 
             WALIterator it = new IgniteWalIteratorFactory(log).iterator(
-                new 
IgniteWalIteratorFactory.IteratorParametersBuilder().filesOrDirs(incSnpWalDir));
+                new 
IgniteWalIteratorFactory.IteratorParametersBuilder().filesOrDirs(incSnpFt.wal()));
 
             boolean started = false;
             boolean finished = false;
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
index 49fa45dd4fb..ec470579557 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotCheckTest.java
@@ -21,9 +21,7 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
-import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -68,7 +66,6 @@ import 
org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabase
 import 
org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointListener;
 import 
org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore;
 import 
org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
-import 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
 import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
 import 
org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionMetaIO;
 import 
org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException;
@@ -89,10 +86,7 @@ import org.junit.Test;
 import static org.apache.ignite.cluster.ClusterState.ACTIVE;
 import static 
org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion.NONE;
 import static 
org.apache.ignite.internal.processors.cache.GridCacheUtils.TTL_ETERNAL;
-import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.partitionFileName;
 import static 
org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId.getTypeByPartId;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.SNAPSHOT_METAFILE_EXT;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.databaseRelativePath;
 import static org.apache.ignite.internal.processors.dr.GridDrType.DR_NONE;
 import static org.apache.ignite.testframework.GridTestUtils.assertContains;
 import static org.apache.ignite.testframework.GridTestUtils.assertNotContains;
@@ -144,12 +138,11 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
 
         createAndCheckSnapshot(ignite, SNAPSHOT_NAME);
 
-        Path part0 = 
U.searchFileRecursively(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath(),
-            partitionFileName(0));
+        File part0 = snapshotFileTree(ignite, 
SNAPSHOT_NAME).partitionFile(dfltCacheCfg, 0);
 
         assertNotNull(part0);
-        assertTrue(part0.toString(), part0.toFile().exists());
-        assertTrue(part0.toFile().delete());
+        assertTrue(part0.toString(), part0.exists());
+        assertTrue(part0.delete());
 
         IdleVerifyResult res = snp(ignite).checkSnapshot(SNAPSHOT_NAME, 
null).get().idleVerifyResult();
 
@@ -164,16 +157,12 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
     @Test
     public void testClusterSnapshotCheckMissedGroup() throws Exception {
         IgniteEx ignite = startGridsWithCache(3, dfltCacheCfg, 
CACHE_KEYS_RANGE);
-        NodeFileTree ft = ignite.context().pdsFolderResolver().fileTree();
 
         createAndCheckSnapshot(ignite, SNAPSHOT_NAME);
 
-        Path dir = 
Files.walk(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath())
-            .filter(d -> 
d.toFile().getName().equals(ft.cacheDirName(dfltCacheCfg)))
-            .findFirst()
-            .orElseThrow(() -> new RuntimeException("Cache directory not 
found"));
+        File dir = snapshotFileTree(ignite, 
SNAPSHOT_NAME).cacheStorage(dfltCacheCfg);
 
-        assertTrue(dir.toString(), dir.toFile().exists());
+        assertTrue(dir.toString(), dir.exists());
         assertTrue(U.delete(dir));
 
         IdleVerifyResult res = snp(ignite).checkSnapshot(SNAPSHOT_NAME, 
null).get().idleVerifyResult();
@@ -192,12 +181,11 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
 
         createAndCheckSnapshot(ignite, SNAPSHOT_NAME);
 
-        File[] smfs = 
snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).listFiles((dir, name) ->
-            name.toLowerCase().endsWith(SNAPSHOT_METAFILE_EXT));
+        File smf = snapshotFileTree(ignite, SNAPSHOT_NAME).meta();
 
-        assertNotNull(smfs);
-        assertTrue(smfs[0].toString(), smfs[0].exists());
-        assertTrue(U.delete(smfs[0]));
+        assertNotNull(smf);
+        assertTrue(smf.toString(), smf.exists());
+        assertTrue(U.delete(smf));
 
         assertThrowsAnyCause(
             log,
@@ -240,18 +228,17 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
 
         createAndCheckSnapshot(ignite, SNAPSHOT_NAME);
 
-        Path part0 = 
U.searchFileRecursively(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath(),
-            partitionFileName(PART_ID));
+        File part0 = snapshotFileTree(ignite, 
SNAPSHOT_NAME).partitionFile(dfltCacheCfg, PART_ID);
 
         assertNotNull(part0);
-        assertTrue(part0.toString(), part0.toFile().exists());
+        assertTrue(part0.toString(), part0.exists());
 
         int grpId = CU.cacheId(dfltCacheCfg.getName());
 
         try (FilePageStore pageStore = 
(FilePageStore)((FilePageStoreManager)ignite.context().cache().context().pageStore())
             .getPageStoreFactory(grpId, 
ignite.context().cache().isEncrypted(grpId))
             .createPageStore(getTypeByPartId(PART_ID),
-                () -> part0,
+                part0::toPath,
                 val -> {
                 })
         ) {
@@ -470,11 +457,10 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
 
         createAndCheckSnapshot(ignite, SNAPSHOT_NAME);
 
-        Path part0 = 
U.searchFileRecursively(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath(),
-            partitionFileName(PART_ID));
+        File part0 = snapshotFileTree(ignite, 
SNAPSHOT_NAME).partitionFile(ccfg, PART_ID);
 
         assertNotNull(part0);
-        assertTrue(part0.toString(), part0.toFile().exists());
+        assertTrue(part0.toString(), part0.exists());
 
         IdleVerifyResult res = snp(ignite).checkSnapshot(SNAPSHOT_NAME, 
null).get().idleVerifyResult();
 
@@ -510,10 +496,7 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
             new SnapshotPartitionsVerifyTaskArg(
                 new HashSet<>(),
                 Collections.singletonMap(ignite.cluster().localNode(),
-                Collections.singletonList(snp(ignite).readSnapshotMetadata(
-                    snp(ignite).snapshotLocalDir(SNAPSHOT_NAME),
-                    (String)ignite.configuration().getConsistentId()
-                ))),
+                
Collections.singletonList(snp(ignite).readSnapshotMetadata(snapshotFileTree(ignite,
 SNAPSHOT_NAME).meta()))),
                 null,
                 0,
                 true
@@ -681,11 +664,7 @@ public class IgniteClusterSnapshotCheckTest extends 
AbstractSnapshotSelfTest {
         CacheConfiguration<?, ?> ccfg,
         int partId
     ) throws IgniteCheckedException, IOException {
-        Path cachePath = 
Paths.get(snp(ignite).snapshotLocalDir(snpName).getAbsolutePath(),
-            
databaseRelativePath(ignite.context().pdsFolderResolver().resolveFolders().folderName()),
-            
ignite.context().pdsFolderResolver().fileTree().cacheDirName(ccfg));
-
-        Path part0 = U.searchFileRecursively(cachePath, 
partitionFileName(partId));
+        Path part0 = snapshotFileTree(ignite, snpName).partitionFile(ccfg, 
partId).toPath();
 
         int grpId = CU.cacheId(ccfg.getName());
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotHandlerTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotHandlerTest.java
index 9adf4e4a5a6..dc07f842002 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotHandlerTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotHandlerTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteFuture;
@@ -47,7 +48,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
 
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.SNAPSHOT_METAFILE_EXT;
 import static 
org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause;
 
 /**
@@ -150,13 +150,11 @@ public class IgniteClusterSnapshotHandlerTest extends 
IgniteClusterSnapshotResto
     private void changeMetadataRequestIdOnDisk(UUID newReqId) throws Exception 
{
         for (Ignite grid : G.allGrids()) {
             IgniteSnapshotManager snpMgr = 
((IgniteEx)grid).context().cache().context().snapshotMgr();
-            String constId = 
grid.cluster().localNode().consistentId().toString();
-            File snpDir = snpMgr.snapshotLocalDir(SNAPSHOT_NAME);
+            SnapshotFileTree sft = snapshotFileTree((IgniteEx)grid, 
SNAPSHOT_NAME);
 
-            SnapshotMetadata metadata = snpMgr.readSnapshotMetadata(snpDir, 
constId);
-            File smf = new File(snpDir, U.maskForFileName(constId) + 
SNAPSHOT_METAFILE_EXT);
+            SnapshotMetadata metadata = 
snpMgr.readSnapshotMetadata(sft.meta());
 
-            try (OutputStream out = new BufferedOutputStream(new 
FileOutputStream(smf))) {
+            try (OutputStream out = new BufferedOutputStream(new 
FileOutputStream(sft.meta()))) {
                 GridTestUtils.setFieldValue(metadata, "rqId", newReqId);
 
                 
U.marshal(((IgniteEx)grid).context().marshallerContext().jdkMarshaller(), 
metadata, out);
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotRestoreSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotRestoreSelfTest.java
index bbd0bd00c43..c3b418bc891 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotRestoreSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotRestoreSelfTest.java
@@ -20,7 +20,6 @@ package 
org.apache.ignite.internal.processors.cache.persistence.snapshot;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.OpenOption;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Collections;
@@ -76,7 +75,6 @@ import static 
org.apache.ignite.events.EventType.EVT_CLUSTER_SNAPSHOT_RESTORE_FI
 import static 
org.apache.ignite.events.EventType.EVT_CLUSTER_SNAPSHOT_RESTORE_STARTED;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.FILE_SUFFIX;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.PART_FILE_PREFIX;
-import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.partitionFileName;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreProcess.TMP_CACHE_DIR_PREFIX;
 import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.RESTORE_CACHE_GROUP_SNAPSHOT_PRELOAD;
 import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.RESTORE_CACHE_GROUP_SNAPSHOT_PREPARE;
@@ -179,12 +177,17 @@ public class IgniteClusterSnapshotRestoreSelfTest extends 
IgniteClusterSnapshotR
     public void testRestoreWithMissedPart() throws Exception {
         IgniteEx ignite = startGridsWithSnapshot(2, CACHE_KEYS_RANGE);
 
-        Path part0 = 
U.searchFileRecursively(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath(),
-            partitionFileName(0));
+        File part0 = null;
 
-        assertNotNull(part0);
-        assertTrue(part0.toString(), part0.toFile().exists());
-        assertTrue(part0.toFile().delete());
+        for (int i = 0; i < 2; i++) {
+            part0 = snapshotFileTree(grid(i), 
SNAPSHOT_NAME).partitionFile(dfltCacheCfg, 0);
+
+            if (part0.exists())
+                break;
+        }
+
+        assertTrue(part0.toString(), part0.exists());
+        assertTrue(part0.delete());
 
         IgniteFuture<Void> fut = 
ignite.snapshot().restoreSnapshot(SNAPSHOT_NAME, null);
         assertThrowsAnyCause(log, () -> fut.get(TIMEOUT), 
IgniteException.class,
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java
index af6dc80f9e2..b0fdfa76f90 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotSelfTest.java
@@ -69,6 +69,7 @@ import 
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Par
 import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
 import 
org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
 import 
org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
 import org.apache.ignite.internal.processors.metric.impl.ObjectGauge;
 import org.apache.ignite.internal.util.distributed.DistributedProcess;
@@ -159,8 +160,7 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
 
         // Start node not in baseline.
         IgniteEx notBltIgnite = startGrid(grids);
-        File locSnpDir = snp(notBltIgnite).snapshotLocalDir(SNAPSHOT_NAME);
-        String notBltDirName = folderName(notBltIgnite);
+        SnapshotFileTree sft = snapshotFileTree(notBltIgnite, SNAPSHOT_NAME);
 
         IgniteCache<Integer, Integer> atCache = ignite.createCache(atomicCcfg);
 
@@ -239,8 +239,8 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
         // Cluster can be deactivated but we must test snapshot restore when 
binary recovery also occurred.
         stopAllGrids();
 
-        assertTrue("Snapshot directory must be empty for node not in baseline 
topology: " + notBltDirName,
-            !searchDirectoryRecursively(locSnpDir.toPath(), 
notBltDirName).isPresent());
+        assertTrue("Snapshot directory must be empty for node not in baseline 
topology: " + sft.folderName(),
+            !searchDirectoryRecursively(sft.root().toPath(), 
sft.folderName()).isPresent());
 
         IgniteEx snpIg0 = startGridsFromSnapshot(grids, snpName);
 
@@ -535,7 +535,7 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
         fut.get();
 
         assertTrue("Snapshot directory must be empty for node 0 due to 
snapshot future fail: " + grid4Dir,
-            
!searchDirectoryRecursively(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath(),
 grid4Dir).isPresent());
+            !searchDirectoryRecursively(snapshotFileTree(ignite, 
SNAPSHOT_NAME).root().toPath(), grid4Dir).isPresent());
     }
 
     /** @throws Exception If fails. */
@@ -578,13 +578,10 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
 
         IgniteFuture<Void> fut = snp(ignite).createSnapshot(SNAPSHOT_NAME, 
null, false, onlyPrimary);
 
-        File snpDir = snp(ignite).snapshotLocalDir(SNAPSHOT_NAME);
+        SnapshotFileTree sft = snapshotFileTree(ignite, SNAPSHOT_NAME);
 
-        assertTrue(snpDir.mkdirs());
-
-        File snpMeta = new File(snpDir, 
IgniteSnapshotManager.snapshotMetaFileName(ignite.localNode().consistentId().toString()));
-
-        assertTrue(snpMeta.createNewFile());
+        assertTrue(sft.root().mkdirs());
+        assertTrue(sft.meta().createNewFile());
 
         assertThrowsAnyCause(log, fut::get, IgniteException.class, "Snapshot 
metafile must not exist");
 
@@ -623,9 +620,9 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
 
         IgniteEx ignite = startGridsWithCache(2, dfltCacheCfg, 
CACHE_KEYS_RANGE);
 
-        File locSnpDir = snp(ignite).snapshotLocalDir(SNAPSHOT_NAME);
-        String dirNameIgnite0 = folderName(ignite);
+        SnapshotFileTree sft = snapshotFileTree(ignite, SNAPSHOT_NAME);
 
+        String dirNameIgnite0 = sft.folderName();
         String dirNameIgnite1 = folderName(grid(1));
 
         snp(grid(1)).localSnapshotSenderFactory(
@@ -650,7 +647,7 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
         waitForEvents(EVT_CLUSTER_SNAPSHOT_STARTED, 
EVT_CLUSTER_SNAPSHOT_FAILED);
 
         assertTrue("Snapshot directory must be empty for node 0 due to 
snapshot future fail: " + dirNameIgnite0,
-            !searchDirectoryRecursively(locSnpDir.toPath(), 
dirNameIgnite0).isPresent());
+            !searchDirectoryRecursively(sft.root().toPath(), 
dirNameIgnite0).isPresent());
 
         startGrid(1);
 
@@ -658,7 +655,7 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
 
         // Snapshot directory must be cleaned.
         assertTrue("Snapshot directory must be empty for node 1 due to 
snapshot future fail: " + dirNameIgnite1,
-            !searchDirectoryRecursively(locSnpDir.toPath(), 
dirNameIgnite1).isPresent());
+            !searchDirectoryRecursively(sft.root().toPath(), 
dirNameIgnite1).isPresent());
 
         List<String> allSnapshots = snp(ignite).localSnapshotNames(null);
 
@@ -671,9 +668,10 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
     public void testRecoveryClusterSnapshotJvmHalted() throws Exception {
         IgniteEx ignite = startGridsWithCache(2, dfltCacheCfg, 
CACHE_KEYS_RANGE);
 
-        String grid0Dir = folderName(ignite);
+        SnapshotFileTree sft = snapshotFileTree(ignite, SNAPSHOT_NAME);
+
+        String grid0Dir = sft.folderName();
         String grid1Dir = folderName(grid(1));
-        File locSnpDir = snp(ignite).snapshotLocalDir(SNAPSHOT_NAME);
 
         jvm = true;
 
@@ -702,18 +700,18 @@ public class IgniteClusterSnapshotSelfTest extends 
AbstractSnapshotSelfTest {
             "Snapshot operation interrupted, because baseline node left the 
cluster");
 
         assertTrue("Snapshot directory must be empty: " + grid0Dir,
-            !searchDirectoryRecursively(locSnpDir.toPath(), 
grid0Dir).isPresent());
+            !searchDirectoryRecursively(sft.root().toPath(), 
grid0Dir).isPresent());
 
         assertTrue("Snapshot directory must be empty: " + grid1Dir,
-            !searchDirectoryRecursively(locSnpDir.toPath(), 
grid1Dir).isPresent());
+            !searchDirectoryRecursively(sft.root().toPath(), 
grid1Dir).isPresent());
 
         assertTrue("Snapshot directory must exist due to grid2 has been halted 
and cleanup not fully performed: " + grid2Dir,
-            searchDirectoryRecursively(locSnpDir.toPath(), 
grid2Dir).isPresent());
+            searchDirectoryRecursively(sft.root().toPath(), 
grid2Dir).isPresent());
 
         IgniteEx grid2 = startGrid(2);
 
         assertTrue("Snapshot directory must be empty after recovery: " + 
grid2Dir,
-            !searchDirectoryRecursively(locSnpDir.toPath(), 
grid2Dir).isPresent());
+            !searchDirectoryRecursively(sft.root().toPath(), 
grid2Dir).isPresent());
 
         awaitPartitionMapExchange();
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotWalRecordTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotWalRecordTest.java
index 9dfe5ea0ef6..5799441d6c2 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotWalRecordTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteClusterSnapshotWalRecordTest.java
@@ -137,8 +137,8 @@ public class IgniteClusterSnapshotWalRecordTest extends 
AbstractSnapshotSelfTest
 
                 if (rec.type() == WALRecord.RecordType.CLUSTER_SNAPSHOT) {
                     SnapshotMetadata metadata = 
snp(grid(i)).readSnapshotMetadata(
-                        snp(grid(i)).snapshotLocalDir(SNAPSHOT_NAME + snpCnt),
-                        (String)grid(i).configuration().getConsistentId());
+                        snapshotFileTree(grid(i), SNAPSHOT_NAME + 
snpCnt).meta()
+                    );
 
                     assertEquals(tuple.getKey(), 
metadata.snapshotRecordPointer());
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
index eff31d2e2a1..c5e23894a40 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java
@@ -56,6 +56,7 @@ import 
org.apache.ignite.internal.processors.cache.persistence.file.FileIODecora
 import 
org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
 import 
org.apache.ignite.internal.processors.cache.persistence.file.FileVersionCheckingFactory;
 import 
org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.typedef.F;
@@ -257,7 +258,7 @@ public class IgniteSnapshotManagerSelfTest extends 
AbstractSnapshotSelfTest {
             @Override public FileIO create(File file, OpenOption... modes) 
throws IOException {
                 FileIO fileIo = ioFactory.create(file, modes);
 
-                if 
(file.getName().equals(IgniteSnapshotManager.partDeltaFileName(0)))
+                if 
(file.getName().equals(SnapshotFileTree.partDeltaFileName(0)))
                     return new FileIODecorator(fileIo) {
                         @Override public int writeFully(ByteBuffer srcBuf) 
throws IOException {
                             if (throwCntr.incrementAndGet() == 3)
@@ -391,7 +392,6 @@ public class IgniteSnapshotManagerSelfTest extends 
AbstractSnapshotSelfTest {
         Map<Integer, Value> iterated = new HashMap<>();
 
         try (GridCloseableIterator<CacheDataRow> iter = 
snp(ignite).partitionRowIterator(SNAPSHOT_NAME,
-            ignite.context().pdsFolderResolver().resolveFolders().folderName(),
             ccfg.getName(),
             0,
             ignite.context().encryption())
@@ -437,7 +437,6 @@ public class IgniteSnapshotManagerSelfTest extends 
AbstractSnapshotSelfTest {
         int rows = 0;
 
         try (GridCloseableIterator<CacheDataRow> iter = 
snp(ignite).partitionRowIterator(SNAPSHOT_NAME,
-            ignite.context().pdsFolderResolver().resolveFolders().folderName(),
             dfltCacheCfg.getName(),
             0,
             ignite.context().encryption())
@@ -484,7 +483,6 @@ public class IgniteSnapshotManagerSelfTest extends 
AbstractSnapshotSelfTest {
         int rows = 0;
 
         try (GridCloseableIterator<CacheDataRow> iter = 
snp(ignite).partitionRowIterator(SNAPSHOT_NAME,
-            ignite.context().pdsFolderResolver().resolveFolders().folderName(),
             dfltCacheCfg.getName(),
             part,
             ignite.context().encryption())
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IncrementalSnapshotTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IncrementalSnapshotTest.java
index 1f2eeee4502..eea0d7b1716 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IncrementalSnapshotTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IncrementalSnapshotTest.java
@@ -33,6 +33,8 @@ import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.TestRecordingCommunicationSpi;
 import org.apache.ignite.internal.processors.cache.GridLocalConfigManager;
 import org.apache.ignite.internal.processors.cache.StoredCacheData;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree.IncrementalSnapshotFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager;
 import org.apache.ignite.internal.util.distributed.DistributedProcess;
 import org.apache.ignite.internal.util.distributed.SingleNodeMessage;
@@ -44,7 +46,6 @@ import org.junit.Test;
 
 import static java.util.Collections.singleton;
 import static java.util.Collections.singletonList;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.snapshotMetaFileName;
 import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.RESTORE_CACHE_GROUP_SNAPSHOT_PRELOAD;
 import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.RESTORE_CACHE_GROUP_SNAPSHOT_PREPARE;
 import static 
org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.RESTORE_CACHE_GROUP_SNAPSHOT_START;
@@ -204,9 +205,9 @@ public class IncrementalSnapshotTest extends 
AbstractSnapshotSelfTest {
         cli.snapshot().createIncrementalSnapshot(SNAPSHOT_NAME).get(TIMEOUT);
         cli.snapshot().createIncrementalSnapshot(SNAPSHOT_NAME).get(TIMEOUT);
 
-        File toRmv = new File(
-            snp(ignite(GRID_CNT - 
1)).incrementalSnapshotLocalDir(SNAPSHOT_NAME, null, 2),
-            snapshotMetaFileName(ignite(GRID_CNT - 
1).localNode().consistentId().toString()));
+        IncrementalSnapshotFileTree ift = snapshotFileTree(ignite(GRID_CNT - 
1), SNAPSHOT_NAME).incrementalSnapshotFileTree(2);
+
+        File toRmv = ift.meta();
 
         assertTrue(toRmv.exists());
 
@@ -341,8 +342,10 @@ public class IncrementalSnapshotTest extends 
AbstractSnapshotSelfTest {
 
         createAndCheckSnapshot(srv, SNAPSHOT_NAME, null, TIMEOUT);
 
-        assertTrue(snp(srv).incrementalSnapshotsLocalRootDir(SNAPSHOT_NAME, 
null).mkdirs());
-        assertTrue(snp(srv).incrementalSnapshotLocalDir(SNAPSHOT_NAME, null, 
1).createNewFile());
+        SnapshotFileTree sft = snapshotFileTree(srv, SNAPSHOT_NAME);
+
+        assertTrue(sft.incrementsRoot().mkdirs());
+        assertTrue(sft.incrementalSnapshotFileTree(1).root().createNewFile());
 
         assertThrows(
             null,
@@ -351,8 +354,11 @@ public class IncrementalSnapshotTest extends 
AbstractSnapshotSelfTest {
             "Failed to create snapshot WAL directory"
         );
 
-        for (int i = 0; i < GRID_CNT; i++)
-            
assertFalse(snp(grid(i)).incrementalSnapshotLocalDir(SNAPSHOT_NAME, null, 
1).exists());
+        for (int i = 0; i < GRID_CNT; i++) {
+            SnapshotFileTree sft0 = snapshotFileTree(grid(i), SNAPSHOT_NAME);
+
+            assertFalse(sft0.incrementalSnapshotFileTree(1).root().exists());
+        }
     }
 
     /** */
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/PlainSnapshotTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/PlainSnapshotTest.java
index 90d77ebfe6b..ddffc81352d 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/PlainSnapshotTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/PlainSnapshotTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.persistence.snapshot;
 
-import java.io.File;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -27,6 +26,7 @@ import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.lang.IgniteFuture;
@@ -97,28 +97,26 @@ public class PlainSnapshotTest extends 
AbstractSnapshotSelfTest {
 
         snpFut.get();
 
+        // Calculate CRCs.
+        NodeFileTree ft = ig.context().pdsFolderResolver().fileTree();
+        SnapshotFileTree sft = snapshotFileTree(ig, SNAPSHOT_NAME);
+
         // Checkpoint forces on cluster deactivation (currently only single 
node in cluster),
         // so we must have the same data in snapshot partitions and those 
which left
         // after node stop.
         stopGrid(ig.name());
 
-        // Calculate CRCs.
-        NodeFileTree ft = ig.context().pdsFolderResolver().fileTree();
-        NodeFileTree snpFt = new 
NodeFileTree(mgr.snapshotLocalDir(SNAPSHOT_NAME).getAbsolutePath(), 
ft.folderName());
-
         final Map<String, Integer> origPartCRCs = 
calculateCRC32Partitions(ft.cacheStorage(dfltCacheCfg));
-        final Map<String, Integer> snpPartCRCs = 
calculateCRC32Partitions(snpFt.cacheStorage(dfltCacheCfg));
+        final Map<String, Integer> snpPartCRCs = 
calculateCRC32Partitions(sft.cacheStorage(dfltCacheCfg));
 
         assertEquals("Partitions must have the same CRC after file copying and 
merging partition delta files",
             origPartCRCs, snpPartCRCs);
         assertEquals("Binary object mappings must be the same for local node 
and created snapshot",
-            calculateCRC32Partitions(ft.binaryMeta()), 
calculateCRC32Partitions(snpFt.binaryMeta()));
+            calculateCRC32Partitions(ft.binaryMeta()), 
calculateCRC32Partitions(sft.binaryMeta()));
         assertEquals("Marshaller meta mast be the same for local node and 
created snapshot",
-            calculateCRC32Partitions(ft.marshaller()), 
calculateCRC32Partitions(snpFt.marshaller()));
-
-        File snpWorkDir = 
ig.context().pdsFolderResolver().fileTree().snapshotTempRoot();
+            calculateCRC32Partitions(ft.marshaller()), 
calculateCRC32Partitions(sft.marshaller()));
 
-        assertEquals("Snapshot working directory must be cleaned after usage", 
0, snpWorkDir.listFiles().length);
+        assertEquals("Snapshot working directory must be cleaned after usage", 
0, ft.snapshotTempRoot().listFiles().length);
     }
 
     /** @throws Exception If fails. */
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
index 571b69a1173..555f9f07ee2 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/IgniteCacheDumpSelf2Test.java
@@ -79,6 +79,7 @@ import 
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl;
 import org.apache.ignite.internal.processors.cache.StoredCacheData;
 import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
 import 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.AbstractCacheDumpTest.TestDumpConsumer;
 import 
org.apache.ignite.internal.processors.cache.version.CacheVersionConflictResolver;
@@ -117,9 +118,7 @@ import static 
org.apache.ignite.internal.encryption.AbstractEncryptionTest.MASTE
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.CACHE_DATA_FILENAME;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.PART_FILE_PREFIX;
 import static 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree.ZIP_SUFFIX;
-import static 
org.apache.ignite.internal.processors.cache.persistence.filename.PdsFolderResolver.DB_DEFAULT_FOLDER;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.AbstractSnapshotSelfTest.doSnapshotCancellationTest;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.DUMP_LOCK;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.SNAPSHOT_TRANSFER_RATE_DMS_KEY;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.AbstractCacheDumpTest.CACHE_0;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.dump.AbstractCacheDumpTest.DMP_NAME;
@@ -381,6 +380,8 @@ public class IgniteCacheDumpSelf2Test extends 
GridCommonAbstractTest {
 
         ign.snapshot().createDump(DMP_NAME, null).get(getTestTimeout());
 
+        SnapshotFileTree sft = snapshotFileTree(grid(1), DMP_NAME);
+
         stopAllGrids();
 
         Dump dump = dump(ign, DMP_NAME);
@@ -390,17 +391,15 @@ public class IgniteCacheDumpSelf2Test extends 
GridCommonAbstractTest {
         assertNotNull(nodes);
         assertEquals(2, nodes.size());
 
-        File nodeDumpDir = new File(dump.dumpDirectory(), DB_DEFAULT_FOLDER + 
File.separator + nodes.get(0));
-
-        assertTrue(new File(nodeDumpDir, DUMP_LOCK).createNewFile());
+        assertTrue(sft.dumpLock().createNewFile());
 
         lsnr = LogListener.matches("Found locked dump dir. " +
             "This means, dump creation not finished prior to node fail. " +
-            "Directory will be deleted: " + 
nodeDumpDir.getAbsolutePath()).build();
+            "Directory will be deleted: " + 
sft.nodeStorage().getAbsolutePath()).build();
 
         startGridsMultiThreaded(2);
 
-        assertFalse(nodeDumpDir.exists());
+        assertFalse(sft.nodeStorage().exists());
         assertTrue(lsnr.check());
     }
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotCheckBeforeRestoreTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotCheckBeforeRestoreTest.java
index 5a181f97428..8d623446908 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotCheckBeforeRestoreTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotCheckBeforeRestoreTest.java
@@ -26,8 +26,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.pagemem.wal.record.RolloverType;
 import 
org.apache.ignite.internal.pagemem.wal.record.delta.ClusterSnapshotRecord;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.AbstractSnapshotSelfTest;
-import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IncrementalSnapshotMetadata;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotPartitionsVerifyTaskResult;
 import 
org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager;
@@ -37,7 +37,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.junit.Test;
 
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.DFLT_CHECK_ON_RESTORE;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.snapshotMetaFileName;
 import static org.junit.Assume.assumeFalse;
 
 /**
@@ -137,9 +136,7 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
         createFullSnapshot();
         createIncrementalSnapshots(1);
 
-        U.delete(new File(
-            snp(srv).snapshotLocalDir(SNP),
-            snapshotMetaFileName((String)srv.localNode().consistentId())));
+        U.delete(snapshotFileTree(srv, SNP).meta());
 
         for (IgniteEx n : F.asList(srv, grid(GRID_CNT))) {
             GridTestUtils.assertThrows(
@@ -157,7 +154,7 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
         createFullSnapshot();
         createIncrementalSnapshots(2);
 
-        U.delete(snp(srv).incrementalSnapshotLocalDir(SNP, null, 1));
+        U.delete(snapshotFileTree(srv, 
SNP).incrementalSnapshotFileTree(1).root());
 
         for (IgniteEx n : F.asList(srv, grid(GRID_CNT))) {
             SnapshotPartitionsVerifyTaskResult res = snp(n).checkSnapshot(SNP, 
null, null, false, 0, DFLT_CHECK_ON_RESTORE)
@@ -242,7 +239,9 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
         createFullSnapshot();
         createIncrementalSnapshots(1, 3);
 
-        File[] segments = incrementalSnapshotWalsDir()
+        SnapshotFileTree sft = snapshotFileTree(srv, SNP);
+
+        File[] segments = sft.incrementalSnapshotFileTree(1).wal()
             .listFiles(f -> 
FileWriteAheadLogManager.WAL_SEGMENT_FILE_COMPACTED_PATTERN.matcher(f.getName()).matches());
 
         Arrays.sort(segments);
@@ -262,9 +261,7 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
         createFullSnapshot();
         createIncrementalSnapshots(2);
 
-        File incMetaFile = new File(
-            snp(srv).incrementalSnapshotLocalDir(SNP, null, 1),
-            snapshotMetaFileName(srv.localNode().consistentId().toString()));
+        File incMetaFile = snapshotFileTree(srv, 
SNP).incrementalSnapshotFileTree(1).meta();
 
         IncrementalSnapshotMetadata meta = snp(srv).readFromFile(incMetaFile);
 
@@ -295,9 +292,7 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
         createFullSnapshot();
         createIncrementalSnapshots(2);
 
-        File incMetaFile = new File(
-            snp(srv).incrementalSnapshotLocalDir(SNP, null, 1),
-            snapshotMetaFileName(srv.localNode().consistentId().toString()));
+        File incMetaFile = snapshotFileTree(srv, 
SNP).incrementalSnapshotFileTree(1).meta();
 
         IncrementalSnapshotMetadata meta = snp(srv).readFromFile(incMetaFile);
 
@@ -322,7 +317,7 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
     }
 
     /** */
-    private void createFullSnapshot() throws IgniteCheckedException {
+    private void createFullSnapshot() {
         createAndCheckSnapshot(grid(0), SNP);
     }
 
@@ -348,7 +343,9 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
 
     /** */
     private void deleteWalSegment(int idx) {
-        File[] segments = incrementalSnapshotWalsDir()
+        SnapshotFileTree sft = snapshotFileTree(srv, SNP);
+
+        File[] segments = sft.incrementalSnapshotFileTree(1).wal()
             .listFiles(f -> 
FileWriteAheadLogManager.WAL_SEGMENT_FILE_COMPACTED_PATTERN.matcher(f.getName()).matches());
 
         Arrays.sort(segments);
@@ -371,11 +368,4 @@ public class IncrementalSnapshotCheckBeforeRestoreTest 
extends AbstractSnapshotS
             srv.context().cache().context().database().checkpointReadUnlock();
         }
     }
-
-    /** */
-    private File incrementalSnapshotWalsDir() {
-        return IgniteSnapshotManager.incrementalSnapshotWalsDir(
-            snp(srv).incrementalSnapshotLocalDir(SNP, null, 1),
-            srv.localNode().consistentId().toString());
-    }
 }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotRestoreTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotRestoreTest.java
index 47618fa7eed..d54e16a0baa 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotRestoreTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/incremental/IncrementalSnapshotRestoreTest.java
@@ -64,7 +64,7 @@ import 
org.apache.ignite.internal.processors.cache.distributed.dht.topology.Grid
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishRequest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
 import 
org.apache.ignite.internal.processors.cache.persistence.db.wal.crc.WalTestUtils;
-import 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotVerifyException;
 import 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IncrementalSnapshotMetadata;
@@ -89,7 +89,6 @@ import org.junit.Test;
 
 import static org.apache.ignite.events.EventType.EVT_CONSISTENCY_VIOLATION;
 import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.AbstractSnapshotSelfTest.snp;
-import static 
org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.incrementalSnapshotWalsDir;
 import static 
org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager.WAL_SEGMENT_COMPACTED_OR_RAW_FILE_FILTER;
 
 /** */
@@ -368,10 +367,11 @@ public class IncrementalSnapshotRestoreTest extends 
AbstractIncrementalSnapshotT
 
         restartWithCleanPersistence();
 
-        NodeFileTree ft = grid(1).context().pdsFolderResolver().fileTree();
+        SnapshotFileTree sft = snapshotFileTree(grid(1), SNP);
 
-        File rm = new File(incrementalSnapshotWalDir(grid(1), SNP, 1), 
ft.zipWalArchiveSegment(0).getName());
+        File rm = sft.incrementalSnapshotFileTree(1).walSegment(0);
 
+        assertTrue(rm.exists());
         assertTrue(U.delete(rm));
 
         GridTestUtils.assertThrowsAnyCause(log,
@@ -970,7 +970,9 @@ public class IncrementalSnapshotRestoreTest extends 
AbstractIncrementalSnapshotT
     private void corruptIncrementalSnapshot(int nodeIdx, int incIdx, int 
segIdx) throws Exception {
         IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(log);
 
-        File[] incSegs = incrementalSnapshotWalDir(grid(nodeIdx), SNP, 
incIdx).listFiles(WAL_SEGMENT_COMPACTED_OR_RAW_FILE_FILTER);
+        SnapshotFileTree sft = snapshotFileTree(grid(nodeIdx), SNP);
+
+        File[] incSegs = 
sft.incrementalSnapshotFileTree(incIdx).wal().listFiles(WAL_SEGMENT_COMPACTED_OR_RAW_FILE_FILTER);
 
         Arrays.sort(incSegs);
 
@@ -1002,13 +1004,6 @@ public class IncrementalSnapshotRestoreTest extends 
AbstractIncrementalSnapshotT
         }
     }
 
-    /** */
-    private File incrementalSnapshotWalDir(IgniteEx node, String snpName, int 
incIdx) {
-        File incSnpDir = snp(node).incrementalSnapshotLocalDir(snpName, null, 
incIdx);
-
-        return incrementalSnapshotWalsDir(incSnpDir, 
node.localNode().consistentId().toString());
-    }
-
     /** {@inheritDoc} */
     @Override protected int nodes() {
         return 3;
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 97262926fa3..425c4e32beb 100755
--- 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -90,6 +90,7 @@ import 
org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import 
org.apache.ignite.internal.processors.cache.persistence.filename.NodeFileTree;
 import 
org.apache.ignite.internal.processors.cache.persistence.filename.SharedFileTree;
+import 
org.apache.ignite.internal.processors.cache.persistence.filename.SnapshotFileTree;
 import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
 import org.apache.ignite.internal.processors.resource.DependencyResolver;
 import 
org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
@@ -3216,4 +3217,18 @@ public abstract class GridAbstractTest extends 
JUnitAssertAware {
             throw new IgniteException(e);
         }
     }
+
+    /**
+     * @return Snapshot directories for specific snapshot.
+     */
+    protected static SnapshotFileTree snapshotFileTree(IgniteEx srv, String 
name) {
+        return snapshotFileTree(srv, name, null);
+    }
+
+    /**
+     * @return Snapshot directories for specific snapshot.
+     */
+    protected static SnapshotFileTree snapshotFileTree(IgniteEx srv, String 
name, String path) {
+        return new SnapshotFileTree(srv, name, path);
+    }
 }

Reply via email to