You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by mm...@apache.org on 2021/07/22 11:20:20 UTC

[ignite] branch master updated: IGNITE-15170 Fixed incorrect comparison of consistent IDs during snapshot restore. (#9270)

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

mmuzaf 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 ab5598a  IGNITE-15170 Fixed incorrect comparison of consistent IDs during snapshot restore. (#9270)
ab5598a is described below

commit ab5598a1d784d1f3c436f636afa5b8dd44a0f28a
Author: Pavel Pereslegin <xx...@gmail.com>
AuthorDate: Thu Jul 22 14:19:55 2021 +0300

    IGNITE-15170 Fixed incorrect comparison of consistent IDs during snapshot restore. (#9270)
---
 .../snapshot/SnapshotRestoreProcess.java           |  2 +-
 .../IgniteClusterSnapshotRestoreSelfTest.java      | 27 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
index f4712e6..261f533 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotRestoreProcess.java
@@ -214,7 +214,7 @@ public class SnapshotRestoreProcess {
 
                 assert meta != null : entry.getKey().id();
 
-                if (!entry.getKey().consistentId().equals(meta.consistentId()))
+                if (!entry.getKey().consistentId().toString().equals(meta.consistentId()))
                     continue;
 
                 if (snpBltNodes == null)
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 f3359f1..139b9a3 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
@@ -44,6 +44,7 @@ import org.apache.ignite.cache.CacheExistsException;
 import org.apache.ignite.cache.CacheMode;
 import org.apache.ignite.cluster.ClusterState;
 import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
@@ -94,6 +95,19 @@ public class IgniteClusterSnapshotRestoreSelfTest extends IgniteClusterSnapshotR
     /** Cache value builder. */
     private Function<Integer, Object> valBuilder = String::valueOf;
 
+    /** Reset consistent ID flag. */
+    private boolean resetConsistentId;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        if (resetConsistentId)
+            cfg.setConsistentId(null);
+
+        return cfg;
+    }
+
     /** {@inheritDoc} */
     @Override protected Function<Integer, Object> valueBuilder() {
         return valBuilder;
@@ -102,6 +116,19 @@ public class IgniteClusterSnapshotRestoreSelfTest extends IgniteClusterSnapshotR
     /** @throws Exception If failed. */
     @Test
     public void testRestoreAllGroups() throws Exception {
+        doRestoreAllGroups();
+    }
+
+    /** @throws Exception If failed. */
+    @Test
+    public void testRestoreAllGroupsWithoutConsistentId() throws Exception {
+        resetConsistentId = true;
+
+        doRestoreAllGroups();
+    }
+
+    /** @throws Exception If failed. */
+    private void doRestoreAllGroups() throws Exception {
         CacheConfiguration<Integer, Object> cacheCfg1 =
             txCacheConfig(new CacheConfiguration<Integer, Object>(CACHE1)).setGroupName(SHARED_GRP);