Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5D305200BEC for ; Thu, 29 Dec 2016 10:37:13 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 5BFA5160B45; Thu, 29 Dec 2016 09:37:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AE9F1160B15 for ; Thu, 29 Dec 2016 10:37:12 +0100 (CET) Received: (qmail 83234 invoked by uid 500); 29 Dec 2016 09:37:06 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 82465 invoked by uid 99); 29 Dec 2016 09:37:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2016 09:37:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 46C67F3520; Thu, 29 Dec 2016 09:37:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.apache.org Date: Thu, 29 Dec 2016 09:37:28 -0000 Message-Id: <53bd25ad779843e880ac8bf591f1fb2f@git.apache.org> In-Reply-To: <9ed165a678e44bff8ed6ffb3e90a45ab@git.apache.org> References: <9ed165a678e44bff8ed6ffb3e90a45ab@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [24/50] [abbrv] ignite git commit: ignite-gg-11650 Stabilize 8.0.2.ea1 branch after merging activation/deactivation fix join inactive node to active cluster (small refactoring) archived-at: Thu, 29 Dec 2016 09:37:13 -0000 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 Authored: Thu Dec 22 16:33:04 2016 +0300 Committer: Dmitriy Govorukhin 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 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(); }