Nikolay Izhikov created IGNITE-27372:
----------------------------------------

             Summary: Snapshot restore fails if indexPath equals to 
extraStoragePath
                 Key: IGNITE-27372
                 URL: https://issues.apache.org/jira/browse/IGNITE-27372
             Project: Ignite
          Issue Type: Sub-task
            Reporter: Nikolay Izhikov


Reproducer:

{noformat}
public class SnapshotCreationNonDeafultStoragePath2Test extends 
GridCommonAbstractTest {
    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

        DataStorageConfiguration dsCfg = new DataStorageConfiguration()
            .setStoragePath(path("path1"))
            .setExtraStoragePaths(path("path2"), path("path3"), path("path4"));

        dsCfg.getDefaultDataRegionConfiguration()
            .setPersistenceEnabled(true);

        return cfg
            .setConsistentId(consId(cfg))
            .setDataStorageConfiguration(dsCfg);
    }

    /** {@inheritDoc} */
    @Override protected void beforeTest() throws Exception {
        super.beforeTest();

        U.delete(new File(U.defaultWorkDirectory()));
    }

    /** {@inheritDoc} */
    @Override protected void afterTest() throws Exception {
        stopAllGrids();

        U.delete(new File(U.defaultWorkDirectory()));
    }

    /** */
    @Test
    public void testSameIndexAndCachePath() throws Exception {
        IgniteEx srv = startGrid(0);

        srv.cluster().state(ClusterState.ACTIVE);

        IgniteCache<Integer, Integer> c = srv.createCache(new 
CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME)
            .setStoragePaths(path("path1"), path("path2"), path("path3"), 
path("path4"))
            .setIndexPath(path("path2")));

        IntStream.range(0, 100).forEach(i -> c.put(i, i));

        srv.snapshot().createSnapshot("snapshot").get();

        stopAllGrids();

        cleanPersistenceDir(true);
        U.delete(new File(path("path1")));
        U.delete(new File(path("path2"), "db"));
        U.delete(new File(path("path3"), "db"));
        U.delete(new File(path("path4"), "db"));

        srv = startGrid(0);

        srv.cluster().state(ClusterState.ACTIVE);

        srv.snapshot().restoreSnapshot("snapshot", null).get();

        IgniteCache<Integer, Integer> c2 = srv.cache(DEFAULT_CACHE_NAME);

        IntStream.range(0, 100).boxed().forEach(i -> assertEquals(i, 
c2.get(i)));
    }

    public String path(String folder) throws IgniteCheckedException {
        return new File(new File(U.defaultWorkDirectory()), 
folder).getAbsolutePath();
    }
}
{noformat}

Fails with the:

{noformat}
Caused by: class org.apache.ignite.IgniteException: 
/Users/user/src/ignite/work/path2/db/filename_SnapshotCreationNonDeafultStoragePath2Test0/_tmp_snp_restore_cache-default
 -> 
/Users/user/src/ignite/work/path2/db/filename_SnapshotCreationNonDeafultStoragePath2Test0/cache-default
        at 
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreProcess.lambda$preload$28(SnapshotRestoreProcess.java:1182)
        at 
java.base/java.util.concurrent.CompletableFuture.biRun(CompletableFuture.java:1375)
        ... 14 more
Caused by: java.nio.file.NoSuchFileException: 
/Users/user/src/ignite/work/path2/db/filename_SnapshotCreationNonDeafultStoragePath2Test0/_tmp_snp_restore_cache-default
 -> 
/Users/user/src/ignite/work/path2/db/filename_SnapshotCreationNonDeafultStoragePath2Test0/cache-default
        at 
java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
        at 
java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:417)
        at 
java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:267)
        at java.base/java.nio.file.Files.move(Files.java:1422)
        at 
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotRestoreProcess.lambda$preload$28(SnapshotRestoreProcess.java:1178)
        ... 15 more

{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to