IGNITE-15170 Fixed incorrect comparison of consistent IDs during snapshot restore. (#9270)

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 @@
 
                 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.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 @@
     /** 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 @@
     /** @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);