ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [5/7] ignite git commit: gg-12389
Date Fri, 30 Jun 2017 18:29:19 GMT
gg-12389


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

Branch: refs/heads/ignite-gg-12389
Commit: 3443d888cce6336eb4866b33a5eb5c8ca89bd4e7
Parents: 66f5eab
Author: sboikov <sboikov@gridgain.com>
Authored: Fri Jun 30 16:33:52 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Fri Jun 30 20:07:56 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/ClusterCachesInfo.java     |  40 +++-
 .../processors/cache/GridCacheProcessor.java    |   8 +
 .../GridDhtPartitionsExchangeFuture.java        |  67 +++++-
 .../cluster/GridClusterStateProcessor.java      |  19 +-
 .../IgniteClusterActivateDeactivateTest.java    | 211 ++++++++++++++++---
 5 files changed, 299 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index a5d68bc..85c5600 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -40,7 +40,7 @@ import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
 import org.apache.ignite.internal.processors.query.QuerySchema;
 import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
@@ -98,6 +98,9 @@ class ClusterCachesInfo {
     /** */
     private Map<UUID, CacheClientReconnectDiscoveryData> clientReconnectReqs;
 
+    /** */
+    private boolean joinOnTransition;
+
     /**
      * @param ctx Context.
      */
@@ -951,11 +954,17 @@ class ClusterCachesInfo {
     private void initStartCachesForLocalJoin(boolean firstNode) {
         assert locJoinStartCaches == null;
 
-        locJoinStartCaches = new ArrayList<>();
-        locCfgsForActivation = new HashMap<>();
-
         if (joinDiscoData != null) {
-           boolean active = ctx.state().clusterState().active() && !ctx.state().clusterState().transition();
+            if (ctx.state().clusterState().transition()) {
+                joinOnTransition = true;
+
+                return;
+            }
+
+            locJoinStartCaches = new ArrayList<>();
+            locCfgsForActivation = new HashMap<>();
+
+            boolean active = ctx.state().clusterState().active() && !ctx.state().clusterState().transition();
 
             for (DynamicCacheDescriptor desc : registeredCaches.values()) {
                 if (firstNode && !joinDiscoData.caches().containsKey(desc.cacheName()))
@@ -1006,6 +1015,17 @@ class ClusterCachesInfo {
     }
 
     /**
+     *
+     */
+    void onStateChangeFinish(ChangeGlobalStateFinishMessage msg) {
+        if (joinOnTransition) {
+            initStartCachesForLocalJoin(false);
+
+            joinOnTransition = false;
+        }
+    }
+
+    /**
      * @param exchangeActions Exchange actions to modify.
      */
     void onStateChangeRequest(ExchangeActions exchangeActions) {
@@ -1040,7 +1060,15 @@ class ClusterCachesInfo {
                 exchangeActions.addCacheGroupToStart(grpDesc);
         }
         else {
-            // TODO GG-12389.
+            for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+                DynamicCacheChangeRequest req =
+                    DynamicCacheChangeRequest.stopRequest(ctx, desc.cacheName(), desc.sql(),
false);
+
+                exchangeActions.addCacheToStop(req, desc);
+            }
+
+            for (CacheGroupDescriptor grpDesc : registeredCacheGroups().values())
+                exchangeActions.addCacheGroupToStop(grpDesc);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/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 ac01ea0..8fc55bd 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
@@ -107,6 +107,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTransactio
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersionManager;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
+import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
 import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
 import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor;
 import org.apache.ignite.internal.processors.plugin.CachePluginManager;
@@ -2287,6 +2288,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @param msg Message.
+     */
+    public void onStateChangeFinish(ChangeGlobalStateFinishMessage msg) {
+        cachesInfo.onStateChangeFinish(msg);
+    }
+
+    /**
      * @param exchangeActions Exchange actions to modify.
      */
     public void onStateChangeRequest(ExchangeActions exchangeActions) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index b10c25c..edd9d63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -742,16 +742,69 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
      * @throws IgniteCheckedException If failed.
      */
     private ExchangeType onClusterStateChangeRequest(boolean crd) throws IgniteCheckedException
{
-        assert exchActions != null && !exchActions.empty() && exchActions.stateChangeRequest()
!= null : this;
+        assert exchActions != null && !exchActions.empty() : this;
+
+        StateChangeRequest req = exchActions.stateChangeRequest();
+
+        assert req != null : exchActions;
+
+        if (req.activate()) {
+            if (log.isInfoEnabled()) {
+                log.info("Start activation process [nodeId=" + cctx.localNodeId() +
+                    ", client=" + cctx.kernalContext().clientNode() +
+                    ", topVer=" + topologyVersion() + "]");
+            }
+
+            try {
+                cctx.activate();
 
-        changeGlobalStateE = cctx.kernalContext().state().changeGlobalState(exchActions.stateChangeRequest());
+                cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
 
-        if (changeGlobalStateE != null) {
-            if (crd)
-                changeGlobalStateExceptions.put(cctx.localNodeId(), changeGlobalStateE);
+                if (log.isInfoEnabled()) {
+                    log.info("Successfully activated caches [nodeId=" + cctx.localNodeId()
+
+                        ", client=" + cctx.kernalContext().clientNode() +
+                        ", topVer=" + topologyVersion() + "]");
+                }
+            }
+            catch (Exception e) {
+                U.error(log, "Failed to activate node components [nodeId=" + cctx.localNodeId()
+
+                    ", client=" + cctx.kernalContext().clientNode() +
+                    ", topVer=" + topologyVersion() + "]", e);
+
+                changeGlobalStateE = e;
+            }
+        }
+        else {
+            if (log.isInfoEnabled()) {
+                log.info("Start deactivation process [nodeId=" + cctx.localNodeId() +
+                    ", client=" + cctx.kernalContext().clientNode() +
+                    ", topVer=" + topologyVersion() + "]");
+            }
+
+            try {
+                cctx.kernalContext().dataStructures().onDeActivate(cctx.kernalContext());
+
+                cctx.kernalContext().service().onDeActivate(cctx.kernalContext());
+
+                cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
+
+                cctx.deactivate();
+
+                if (log.isInfoEnabled()) {
+                    log.info("Successfully deactivated data structures, services and caches
[" +
+                        "nodeId=" + cctx.localNodeId() +
+                        ", client=" + cctx.kernalContext().clientNode() +
+                        ", topVer=" + topologyVersion() + "]");
+                }
+            }
+            catch (Exception e) {
+                U.error(log, "Failed to deactivate node components [nodeId=" + cctx.localNodeId()
+
+                    ", client=" + cctx.kernalContext().clientNode() +
+                    ", topVer=" + topologyVersion() + "]", e);
+
+                changeGlobalStateE = e;
+            }
         }
-        else
-            cctx.affinity().onCacheChangeRequest(this, crd, exchActions);
 
         return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index 6f1f769..3a2811a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -165,8 +165,11 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
         if (joinFut != null)
             joinFut.onDone(msg.clusterActive());
 
-        if (msg.requestId().equals(globalState.transitionRequestId()))
+        if (msg.requestId().equals(globalState.transitionRequestId())) {
             globalState = DiscoveryDataClusterState.createState(msg.clusterActive());
+
+            ctx.cache().onStateChangeFinish(msg);
+        }
     }
 
     /**
@@ -410,8 +413,6 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
 
                 sharedCtx.affinity().removeAllCacheInfo();
 
-                ctx.discovery().cleanCachesAndGroups();
-
                 if (!ctx.clientNode()) {
                     sharedCtx.database().onDeActivate(ctx);
 
@@ -849,6 +850,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
 
         /**
          * @param state Current state.
+         * @param discoCache Discovery data cache.
          */
         TransitionOnJoinWaitFuture(DiscoveryDataClusterState state, DiscoCache discoCache)
{
             assert state.transition() : state;
@@ -860,5 +862,16 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
                     transitionNodes.add(nodeId);
             }
         }
+
+        /** {@inheritDoc} */
+        @Override public boolean onDone(@Nullable Boolean res, @Nullable Throwable err) {
+            if (super.onDone(res, err)) {
+                joinFut = null;
+
+                return true;
+            }
+
+            return false;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3443d888/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
index f5cbc56..580c0d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTest.java
@@ -21,6 +21,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cluster.ClusterNode;
@@ -30,7 +31,9 @@ import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.configuration.PersistentStoreConfiguration;
 import org.apache.ignite.configuration.WALMode;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiPredicate;
@@ -157,7 +160,7 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
     /**
      * @param srvs Number of servers.
      * @param clients Number of clients.
-     * @param activateFrom Index of node running activation.
+     * @param activateFrom Index of node stating activation.
      * @throws Exception If failed.
      */
     private void activateSimple(int srvs, int clients, int activateFrom) throws Exception
{
@@ -165,38 +168,49 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
 
         final int CACHES = 2;
 
-        for (int i = 0; i < srvs; i++) {
-            client = false;
+        for (int i = 0; i < srvs + clients; i++) {
+            client = i >= srvs;
 
             ccfgs = cacheConfigurations1();
 
             startGrid(i);
-        }
-
-        for (int i = 0; i < clients; i++) {
-            client = true;
-
-            ccfgs = cacheConfigurations1();
 
-            startGrid(srvs + i);
+            checkNoCaches(i);
         }
 
+        for (int i = 0; i < srvs + clients; i++)
+            assertFalse(ignite(i).active());
+
         ignite(activateFrom).active(false); // Should be no-op.
 
         ignite(activateFrom).active(true);
 
+        for (int i = 0; i < srvs + clients; i++)
+            assertTrue(ignite(i).active());
+
+        for (int i = 0; i < srvs + clients; i++) {
+            for (int c = 0; c < 2; c++)
+                checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+        }
+
         checkCaches(srvs + clients, CACHES);
 
         client = false;
 
         startGrid(srvs + clients);
 
+        for (int c = 0; c < 2; c++)
+            checkCache(ignite(srvs + clients), CACHE_NAME_PREFIX + c, true);
+
         checkCaches(srvs + clients + 1, CACHES);
 
         client = true;
 
         startGrid(srvs + clients + 1);
 
+        for (int c = 0; c < 2; c++)
+            checkCache(ignite(srvs + clients + 1), CACHE_NAME_PREFIX + c, false);
+
         checkCaches(srvs + clients + 2, CACHES);
     }
 
@@ -225,11 +239,79 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
     /**
      * @throws Exception If failed.
      */
-    public void testJoinWhileActivate1() throws Exception {
+    public void testJoinWhileActivate1_Server() throws Exception {
+        joinWhileActivate1(false, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinWhileActivate1_WithCache_Server() throws Exception {
+        joinWhileActivate1(false, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinWhileActivate1_Client() throws Exception {
+        joinWhileActivate1(true, false);
+    }
+
+    /**
+     * @param startClient If {@code true} joins client node, otherwise server.
+     * @param withNewCache If {@code true} joining node has new cache in configuration.
+     * @throws Exception If failed.
+     */
+    private void joinWhileActivate1(final boolean startClient, final boolean withNewCache)
throws Exception {
+        IgniteInternalFuture<?> activeFut = startNodesAndBlockActivation(2, 0);
+
+        IgniteInternalFuture<?> startFut = GridTestUtils.runAsync(new Callable<Void>()
{
+            @Override public Void call() throws Exception {
+                client = startClient;
+
+                ccfgs = withNewCache ? cacheConfigurations2() : cacheConfigurations1();
+
+                startGrid(2);
+
+                return null;
+            }
+        });
+
+        TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(ignite(1));
+
+        spi1.stopBlock();
+
+        activeFut.get();
+        startFut.get();
+
+        for (int c = 0; c < 2; c++)
+            checkCache(ignite(2), CACHE_NAME_PREFIX + c, true);
+
+        if (withNewCache) {
+            for (int i = 0; i < 3; i++) {
+                for (int c = 0; c < 4; c++)
+                    checkCache(ignite(i), CACHE_NAME_PREFIX + c, true);
+            }
+        }
+
+        awaitPartitionMapExchange();
+
+        checkCaches(3, withNewCache ? 4 : 2);
+    }
+
+    /**
+     * @param srvs Number of servers.
+     * @param clients Number of clients.
+     * @return Activation future.
+     * @throws Exception If failed.
+     */
+    private IgniteInternalFuture<?> startNodesAndBlockActivation(int srvs, int clients)
throws Exception {
         active = false;
         testSpi = true;
 
-        for (int i = 0; i < 2; i++) {
+        for (int i = 0; i < srvs + clients; i++) {
+            client = i >= srvs;
+
             ccfgs = cacheConfigurations1();
 
             startGrid(i);
@@ -237,12 +319,14 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
 
         TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(ignite(1));
 
+        final AffinityTopologyVersion ACTIVATE_TOP_VER = new AffinityTopologyVersion(srvs
+ clients, 1);
+
         spi1.blockMessages(new IgniteBiPredicate<ClusterNode, Message>() {
             @Override public boolean apply(ClusterNode clusterNode, Message msg) {
                 if (msg instanceof GridDhtPartitionsSingleMessage) {
                     GridDhtPartitionsSingleMessage pMsg = (GridDhtPartitionsSingleMessage)msg;
 
-                    if (pMsg.exchangeId() != null && pMsg.exchangeId().topologyVersion().topologyVersion()
== 2)
+                    if (pMsg.exchangeId() != null && pMsg.exchangeId().topologyVersion().equals(ACTIVATE_TOP_VER))
                         return true;
                 }
 
@@ -262,28 +346,13 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
 
         assertFalse(activeFut.isDone());
 
-        IgniteInternalFuture<?> startFut = GridTestUtils.runAsync(new Callable<Void>()
{
-            @Override public Void call() throws Exception {
-                ccfgs = cacheConfigurations1();
-
-                startGrid(2);
-
-                return null;
-            }
-        });
-
-        spi1.stopBlock();
-
-        activeFut.get();
-        startFut.get();
-
-        checkCaches(3, 2);
+        return activeFut;
     }
 
     /**
      * @throws Exception If failed.
      */
-    public void testJoinAndActivate() throws Exception {
+    public void testConcurrentJoinAndActivate() throws Exception {
         for (int iter = 0; iter < 3; iter++) {
             log.info("Iteration: " + iter);
 
@@ -335,6 +404,48 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testDeactivateSimpleSingleNode() throws Exception {
+        deactivateSimple(1, 0, 0);
+    }
+
+    /**
+     * @param srvs Number of servers.
+     * @param clients Number of clients.
+     * @param deactivateFrom Index of node stating deactivation.
+     * @throws Exception If failed.
+     */
+    private void deactivateSimple(int srvs, int clients, int deactivateFrom) throws Exception
{
+        active = true;
+
+        final int CACHES = 2;
+
+        for (int i = 0; i < srvs + clients; i++) {
+            client = i >= srvs;
+
+            ccfgs = cacheConfigurations1();
+
+            startGrid(i);
+        }
+
+        if (persistenceEnabled())
+            ignite(deactivateFrom).active(true);
+
+        ignite(deactivateFrom).active(true); // Should be no-op.
+
+        checkCaches(srvs + clients, CACHES);
+
+        for (int i = 0; i < srvs + clients; i++)
+            assertTrue(ignite(i).active());
+
+        ignite(deactivateFrom).active(false);
+
+        for (int i = 0; i < srvs + clients; i++)
+            assertFalse(ignite(i).active());
+    }
+
+    /**
      * @return Cache configurations.
      */
     private CacheConfiguration[] cacheConfigurations1() {
@@ -347,6 +458,20 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
     }
 
     /**
+     * @return Cache configurations.
+     */
+    private CacheConfiguration[] cacheConfigurations2() {
+        CacheConfiguration[] ccfgs = new CacheConfiguration[4];
+
+        ccfgs[0] = cacheConfigurations(CACHE_NAME_PREFIX + 0, ATOMIC);
+        ccfgs[1] = cacheConfigurations(CACHE_NAME_PREFIX + 1, TRANSACTIONAL);
+        ccfgs[2] = cacheConfigurations(CACHE_NAME_PREFIX + 2, ATOMIC);
+        ccfgs[3] = cacheConfigurations(CACHE_NAME_PREFIX + 3, TRANSACTIONAL);
+
+        return ccfgs;
+    }
+
+    /**
      * @param name Cache name.
      * @param atomicityMode Atomicity mode.
      * @return Cache configuration.
@@ -360,4 +485,30 @@ public class IgniteClusterActivateDeactivateTest extends GridCommonAbstractTest
 
         return ccfg;
     }
+
+    /**
+     * @param cacheName Cache name.
+     * @param node Node.
+     * @param exp {@code True} if expect that cache is started on node.
+     */
+    private void checkCache(Ignite node, String cacheName, boolean exp) {
+        GridCacheAdapter cache = ((IgniteKernal)node).context().cache().internalCache(cacheName);
+
+        if (exp)
+            assertNotNull(cache);
+        else
+            assertNull(cache);
+    }
+
+    /**
+     * @param nodes Number of nodes.
+     */
+    private void checkNoCaches(int nodes) {
+        for (int i = 0; i < nodes; i++) {
+            GridCacheProcessor cache = ((IgniteKernal)ignite(i)).context().cache();
+
+            assertTrue(cache.caches().isEmpty());
+            assertTrue(cache.internalCaches().isEmpty());
+        }
+    }
 }


Mime
View raw message