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 39fa1032e0a IGNITE-24535 Fix of remote nodes startup in
SnapshotCompatibilityTest (#11986)
39fa1032e0a is described below
commit 39fa1032e0ae49ccccacf5922ebc47b1a66140a8
Author: Vladislav Novikov <[email protected]>
AuthorDate: Mon May 12 11:46:50 2025 +0300
IGNITE-24535 Fix of remote nodes startup in SnapshotCompatibilityTest
(#11986)
---
.../persistence/SnapshotCompatibilityTest.java | 54 +++++++++++++---------
1 file changed, 31 insertions(+), 23 deletions(-)
diff --git
a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/SnapshotCompatibilityTest.java
b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/SnapshotCompatibilityTest.java
index 18cf026b31c..46184bd5a66 100644
---
a/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/SnapshotCompatibilityTest.java
+++
b/modules/compatibility/src/test/java/org/apache/ignite/compatibility/persistence/SnapshotCompatibilityTest.java
@@ -26,9 +26,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nullable;
+
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
@@ -54,7 +53,9 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
/**
*
@@ -82,16 +83,13 @@ public class SnapshotCompatibilityTest extends
IgniteCompatibilityAbstractTest {
/** */
private static final String CUSTOM_SNP_RELATIVE_PATH = "ex_snapshots";
- /** */
- private static final String CONSISTENT_ID = UUID.randomUUID().toString();
-
/** */
@Parameterized.Parameter
public boolean incSnp;
/** */
@Parameterized.Parameter(1)
- @Nullable public String consId;
+ public boolean customConsId;
/** */
@Parameterized.Parameter(2)
@@ -112,23 +110,18 @@ public class SnapshotCompatibilityTest extends
IgniteCompatibilityAbstractTest {
/** */
private CacheGroupInfo cacheGrpInfo;
- /**
- * The test is parameterized by whether an incremental snapshot is taken
and by consistentId.
- * Restore incremental snapshot if consistentId is null is fixed in
2.17.0, see here https://issues.apache.org/jira/browse/IGNITE-23222.
- * Also restoring cache dump and any kind of snapshot is pointless.
- */
- @Parameters(name = "incrementalSnp={0}, consistentID={1}, oldNodesCnt={2},
cacheDump={3}, customSnpPath={4}, testCacheGrp={5}")
+ /** */
+ @Parameterized.Parameters(name = "incSnp={0}, customConsId={1},
oldNodesCnt={2}, cacheDump={3}, customSnpPath={4}, testCacheGrp={5}")
public static Collection<Object[]> data() {
List<Object[]> data = new ArrayList<>();
for (boolean incSnp : Arrays.asList(true, false))
- for (String consId : Arrays.asList(CONSISTENT_ID, null))
+ for (boolean customConsId: Arrays.asList(true, false))
for (int oldNodesCnt : Arrays.asList(1, 3))
for (boolean cacheDump : Arrays.asList(true, false))
for (boolean customSnpPath : Arrays.asList(true,
false))
for (boolean testCacheGrp : Arrays.asList(true,
false))
- if ((!incSnp || !cacheDump) && (!incSnp ||
consId != null))
- data.add(new Object[]{incSnp, consId,
oldNodesCnt, cacheDump, customSnpPath, testCacheGrp});
+ data.add(new Object[]{incSnp, customConsId,
oldNodesCnt, cacheDump, customSnpPath, testCacheGrp});
return data;
}
@@ -142,19 +135,29 @@ public class SnapshotCompatibilityTest extends
IgniteCompatibilityAbstractTest {
/** */
@Test
public void testSnapshotRestore() throws Exception {
+ if (incSnp) {
+ assumeFalse("Incremental snapshots for cache dump not supported",
cacheDump);
+
+ assumeTrue("Incremental snapshots require same consistentID",
customConsId);
+
+ assumeTrue("https://issues.apache.org/jira/browse/IGNITE-25096",
oldNodesCnt == 1);
+ }
+
try {
- startGrid(
- oldNodesCnt,
- OLD_IGNITE_VERSION,
- new ConfigurationClosure(incSnp, consId, customSnpPath, true,
cacheGrpInfo),
- new CreateSnapshotClosure(incSnp, cacheDump, cacheGrpInfo)
- );
+ for (int i = 1; i <= oldNodesCnt; ++i) {
+ startGrid(
+ i,
+ OLD_IGNITE_VERSION,
+ new ConfigurationClosure(incSnp, consId(i), customSnpPath,
true, cacheGrpInfo),
+ i == oldNodesCnt ? new CreateSnapshotClosure(incSnp,
cacheDump, cacheGrpInfo) : null
+ );
+ }
stopAllGrids();
cleanPersistenceDir(true);
- IgniteEx node = startGrid(currentIgniteConfiguration(incSnp,
consId, customSnpPath));
+ IgniteEx node = startGrid(currentIgniteConfiguration(incSnp,
consId(1), customSnpPath));
node.cluster().state(ClusterState.ACTIVE);
@@ -274,6 +277,11 @@ public class SnapshotCompatibilityTest extends
IgniteCompatibilityAbstractTest {
return cfg;
}
+ /** */
+ private String consId(int nodeIdx) {
+ return customConsId ? "node-" + nodeIdx : null;
+ }
+
/** */
private static String customSnapshotPath(String relativePath, boolean
delIfExist) throws IgniteCheckedException {
return U.resolveWorkDirectory(U.defaultWorkDirectory(), relativePath,
delIfExist).getAbsolutePath();