GG-12210 Don't allow join server node and smart merge client configuration 
during snapshot restore
-fail server join during snapshot restore


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6cf5d59c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6cf5d59c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6cf5d59c

Branch: refs/heads/ignite-5398
Commit: 6cf5d59c07a86c9bb0c78d2447970ba11977621d
Parents: f169a18
Author: EdShangGG <[email protected]>
Authored: Tue May 23 18:02:29 2017 +0300
Committer: EdShangGG <[email protected]>
Committed: Tue May 23 19:42:11 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java      | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6cf5d59c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 71a2dc5..5368e37 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -106,6 +106,7 @@ import 
org.apache.ignite.internal.processors.plugin.CachePluginManager;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
 import org.apache.ignite.internal.util.F0;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -174,6 +175,9 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
     /** Map of proxies. */
     private final ConcurrentMap<String, IgniteCacheProxy<?, ?>> jCacheProxies;
 
+    /** Restarting caches */
+    private final Set<String> restartingCaches = new GridConcurrentHashSet<>();
+
     /** Caches stop sequence. */
     private final Deque<String> stopSeq;
 
@@ -1117,6 +1121,7 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
 
                 caches.remove(maskNull(cache.name()));
                 jCacheProxies.remove(maskNull(cache.name()));
+                restartingCaches.remove(maskNull(cache.name()));
 
                 IgniteInternalFuture<?> fut = ctx.closure().runLocalSafe(new 
Runnable() {
                     @Override public void run() {
@@ -1857,8 +1862,11 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
 
             onKernalStart(cache);
 
-            if (proxyRestart)
+            if (proxyRestart) {
                 proxy.onRestarted(cacheCtx, cache);
+
+                restartingCaches.remove(maskNull(cacheCtx.name()));
+            }
         }
     }
 
@@ -1897,6 +1905,8 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
         if (req.restart()) {
             proxy = jCacheProxies.get(maskNull(req.cacheName()));
 
+            restartingCaches.add(req.cacheName());
+
             if (proxy != null)
                 proxy.restart();
         }
@@ -3164,6 +3174,12 @@ public class GridCacheProcessor extends 
GridProcessorAdapter {
      */
     @Nullable private IgniteNodeValidationResult 
validateHashIdResolvers(ClusterNode node) {
         if (!node.isClient()) {
+            if (restartingCaches.size() > 0) {
+                String msg = "Joining server node during cache restarting is 
not allowed";
+
+                return new IgniteNodeValidationResult(node.id(), msg, msg);
+            }
+
             for (DynamicCacheDescriptor desc : registeredCaches.values()) {
                 CacheConfiguration cfg = desc.cacheConfiguration();
 

Reply via email to