ignite-gg-11650 Stabilize 8.0.2.ea1 branch after merging activation/deactivation fix join inactive node to active cluster (small refactoring)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/842c1b7b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/842c1b7b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/842c1b7b Branch: refs/heads/ignite-3477 Commit: 842c1b7b8f2063b99cdd4b7740510c2e0b2e2553 Parents: 691c3b7 Author: Dmitriy Govorukhin <[email protected]> Authored: Thu Dec 22 16:33:04 2016 +0300 Committer: Dmitriy Govorukhin <[email protected]> Committed: Thu Dec 22 16:33:04 2016 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheProcessor.java | 26 +++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/842c1b7b/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 f7a816e..03859d3 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 @@ -755,33 +755,31 @@ public class GridCacheProcessor extends GridProcessorAdapter { //if we start as inactive node, and join to active cluster, we must registrate all caches which //was receive on join if (!ctx.isDaemon() && currentStatus && !activeOnStart) { - CacheConfiguration[] cacheCfgs = ctx.config().getCacheConfiguration(); - - CacheConfiguration[] newCacheCfg = new CacheConfiguration[cacheCfgs.length]; - - boolean apply = false; - - for (int i = 0; i < cacheCfgs.length; i++) { - CacheConfiguration conf = cacheCfgs[i]; + List<CacheConfiguration> tmpCacheCfg = new ArrayList<>(); + for (CacheConfiguration conf : ctx.config().getCacheConfiguration()) { for (DynamicCacheDescriptor desc : registeredCaches.values()) { CacheConfiguration c = desc.cacheConfiguration(); - IgnitePredicate filter = conf.getNodeFilter(); + IgnitePredicate filter = c.getNodeFilter(); if (c.getName().equals(conf.getName()) && - (desc.receivedOnDiscovery() || CU.isSystemCache(c.getName()))) { - - newCacheCfg[i] = c; + ((desc.receivedOnDiscovery() && CU.affinityNode(locNode, filter)) || + CU.isSystemCache(c.getName()))) { - apply = true; + tmpCacheCfg.add(c); break; } } } - if (apply) + if (!tmpCacheCfg.isEmpty()) { + CacheConfiguration[] newCacheCfg = new CacheConfiguration[tmpCacheCfg.size()]; + + tmpCacheCfg.toArray(newCacheCfg); + ctx.config().setCacheConfiguration(newCacheCfg); + } activeOnStart = ctx.state().active(); }
