IGNITE-10916 Added guard for cache restarting in progress for Visor tasks.
authorVasiliy Sisko <vsisko@gridgain.com>
Mon, 14 Jan 2019 07:30:02 +0000 (14:30 +0700)
committerAlexey Kuznetsov <akuznetsov@apache.org>
Mon, 14 Jan 2019 07:30:02 +0000 (14:30 +0700)
modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCachePartitionsTask.java

index 9cf2c89..51477c9 100644 (file)
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.util.VisorTaskUtils;
 import org.apache.ignite.lang.IgniteUuid;
 
 /**
@@ -63,7 +64,7 @@ public class VisorCacheConfigurationCollectorJob
 
             boolean matched = hasPtrn ? ptrn.matcher(cacheName).find() : all || arg.getCacheNames().contains(cacheName);
 
-            if (matched) {
+            if (!VisorTaskUtils.isRestartingCache(ignite, cacheName) && matched) {
                 VisorCacheConfiguration cfg =
                     config(cache.getConfiguration(CacheConfiguration.class), cache.context().dynamicDeploymentId());
 
index ab1fa8c..4c18ba3 100644 (file)
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.apache.ignite.internal.visor.util.VisorTaskUtils;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -110,15 +111,17 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<VisorCach
             boolean allCaches = cacheNames.isEmpty();
 
             for (IgniteCacheProxy ca : caches) {
-                GridCacheContext ctx = ca.context();
+                String cacheName = ca.getName();
 
-                if (ctx.started() && (ctx.affinityNode() || ctx.isNear())) {
-                    String cacheName = ca.getName();
+                if (!VisorTaskUtils.isRestartingCache(ignite, cacheName)) {
+                    GridCacheContext ctx = ca.context();
 
-                    VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName);
+                    if (ctx.started() && (ctx.affinityNode() || ctx.isNear())) {
+                        VisorCacheMetrics cm = new VisorCacheMetrics(ignite, cacheName);
 
-                    if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem()))
-                        res.add(cm);
+                        if ((allCaches || cacheNames.contains(cacheName)) && (showSysCaches || !cm.isSystem()))
+                            res.add(cm);
+                    }
                 }
             }
 
index 93c9c60..11ae18d 100644 (file)
@@ -36,10 +36,11 @@ import org.apache.ignite.internal.processors.task.GridInternal;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.visor.VisorJob;
 import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.apache.ignite.internal.visor.util.VisorTaskUtils;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log;
 import static org.apache.ignite.internal.visor.util.VisorTaskUtils.escapeName;
+import static org.apache.ignite.internal.visor.util.VisorTaskUtils.log;
 
 /**
  * Task that collect keys distribution in partitions.
@@ -98,7 +99,7 @@ public class VisorCachePartitionsTask extends VisorMultiNodeTask<VisorCacheParti
             GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
 
             // Cache was not started.
-            if (ca == null || !ca.context().started())
+            if (ca == null || !ca.context().started() || VisorTaskUtils.isRestartingCache(ignite, cacheName))
                 return parts;
 
             CacheConfiguration cfg = ca.configuration();