IGNITE-45 - WIP
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ff5c047c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ff5c047c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ff5c047c Branch: refs/heads/ignite-45 Commit: ff5c047c66d98b5fd937dff3c8b2ff8ccd7b31b3 Parents: 62d39de Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Thu Mar 5 17:17:33 2015 -0800 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Thu Mar 5 17:17:33 2015 -0800 ---------------------------------------------------------------------- .../processors/cache/GridCacheProcessor.java | 24 +++++++++++--------- .../cache/IgniteDynamicCacheStartSelfTest.java | 7 +----- 2 files changed, 14 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff5c047c/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 ea7cb9c..e7bc1ec 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 @@ -667,6 +667,8 @@ public class GridCacheProcessor extends GridProcessorAdapter { for (DynamicCacheDescriptor desc : dynamicCaches.values()) { GridCacheContext ctx = createCache(desc.cacheConfiguration()); + ctx.dynamicDeploymentId(desc.deploymentId()); + sharedCtx.addCacheContext(ctx); GridCacheAdapter cache = ctx.cache(); @@ -1232,7 +1234,8 @@ public class GridCacheProcessor extends GridProcessorAdapter { sharedCtx.removeCacheContext(ctx); - assert req.deploymentId().equals(ctx.dynamicDeploymentId()); + assert req.deploymentId().equals(ctx.dynamicDeploymentId()) : "Different deployment IDs [req=" + req + + ", ctxDepId=" + ctx.dynamicDeploymentId() + ']'; onKernalStop(cache, true); stopCache(cache, true); @@ -1335,11 +1338,16 @@ public class GridCacheProcessor extends GridProcessorAdapter { Collection<DynamicCacheChangeRequest> reqs = new ArrayList<>(dynamicCaches.size()); for (DynamicCacheDescriptor desc : dynamicCaches.values()) { - if (!desc.cancelled()) - reqs.add(new DynamicCacheChangeRequest(desc.cacheConfiguration(), desc.nodeFilter())); - } + if (!desc.cancelled()) { + DynamicCacheChangeRequest req = new DynamicCacheChangeRequest( + desc.cacheConfiguration(), + desc.nodeFilter()); - U.debug(log, "Collected discovery data for cache: " + reqs.size()); + req.deploymentId(desc.deploymentId()); + + reqs.add(req); + } + } return new DynamicCacheChangeBatch(reqs); } @@ -1349,8 +1357,6 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (data instanceof DynamicCacheChangeBatch) { DynamicCacheChangeBatch batch = (DynamicCacheChangeBatch)data; - U.debug(log, "Received discovery data: " + batch.requests()); - for (DynamicCacheChangeRequest req : batch.requests()) { dynamicCaches.put(req.cacheName(), new DynamicCacheDescriptor( req.startCacheConfiguration(), @@ -1487,8 +1493,6 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param batch Change request batch. */ private void onCacheChangeRequested(DynamicCacheChangeBatch batch) { - U.debug(log, "<><><>Received cache change request: " + batch.requests().size()); - for (DynamicCacheChangeRequest req : batch.requests()) { if (req.isStart()) { CacheConfiguration ccfg = req.startCacheConfiguration(); @@ -1535,8 +1539,6 @@ public class GridCacheProcessor extends GridProcessorAdapter { return; } - U.debug(log, "Cancelling descriptor: " + desc); - desc.onCancelled(); ctx.discovery().removeDynamicCacheFilter(req.cacheName()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff5c047c/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java index 3b40dc3..6c96b36 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java @@ -271,12 +271,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { assertEquals("1", grid(g).jcache(CACHE_NAME).get("1")); // Undeploy cache. - kernal.context().cache().dynamicStopCache(CACHE_NAME).get(); // TODO debug without get(). - - info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + kernal.context().cache().dynamicStopCache(CACHE_NAME).get(); startGrid(nodeCount() + 1);