Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E331B1835C for ; Thu, 18 Jun 2015 22:49:22 +0000 (UTC) Received: (qmail 29617 invoked by uid 500); 18 Jun 2015 22:49:22 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 29586 invoked by uid 500); 18 Jun 2015 22:49:22 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 29573 invoked by uid 99); 18 Jun 2015 22:49:22 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2015 22:49:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 61396C009B for ; Thu, 18 Jun 2015 22:49:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id TVWpUI2HAj3P for ; Thu, 18 Jun 2015 22:49:14 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id CE6C820DC7 for ; Thu, 18 Jun 2015 22:49:12 +0000 (UTC) Received: (qmail 29540 invoked by uid 99); 18 Jun 2015 22:49:11 -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, 18 Jun 2015 22:49:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BC767E3CA6; Thu, 18 Jun 2015 22:49:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: IGNITE-1026 - Fixing dynamic cache start methods. Date: Thu, 18 Jun 2015 22:49:11 +0000 (UTC) Repository: incubator-ignite Updated Branches: refs/heads/ignite-1026 eef2b372f -> bb73b66c6 IGNITE-1026 - Fixing dynamic cache start methods. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/bb73b66c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/bb73b66c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/bb73b66c Branch: refs/heads/ignite-1026 Commit: bb73b66c6d29de578da3aed2654c2a887c97337c Parents: eef2b37 Author: Alexey Goncharuk Authored: Thu Jun 18 15:49:06 2015 -0700 Committer: Alexey Goncharuk Committed: Thu Jun 18 15:49:06 2015 -0700 ---------------------------------------------------------------------- .../apache/ignite/internal/IgniteKernal.java | 16 +++++----- .../processors/cache/GridCacheProcessor.java | 31 ++++++++++++-------- .../datastructures/DataStructuresProcessor.java | 2 +- .../cache/IgniteDynamicCacheStartSelfTest.java | 4 +-- 4 files changed, 30 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bb73b66c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java index e19d3d3..3ee260d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java @@ -2265,7 +2265,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { guard(); try { - ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), null, true).get(); + ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), null, true, true).get(); return ctx.cache().publicJCache(cacheCfg.getName()); } @@ -2302,7 +2302,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { try { if (ctx.cache().cache(cacheCfg.getName()) == null) - ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), null, false).get(); + ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), null, false, true).get(); return ctx.cache().publicJCache(cacheCfg.getName()); } @@ -2325,7 +2325,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { guard(); try { - ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), nearCfg, true).get(); + ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), nearCfg, true, true).get(); return ctx.cache().publicJCache(cacheCfg.getName()); } @@ -2349,10 +2349,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { IgniteInternalCache cache = ctx.cache().cache(cacheCfg.getName()); if (cache == null) - ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), nearCfg, false).get(); + ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), nearCfg, false, true).get(); else { if (cache.configuration().getNearConfiguration() == null) - ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), nearCfg, false).get(); + ctx.cache().dynamicStartCache(cacheCfg, cacheCfg.getName(), nearCfg, false, true).get(); } return ctx.cache().publicJCache(cacheCfg.getName()); @@ -2372,7 +2372,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { guard(); try { - ctx.cache().dynamicStartCache(null, cacheName, nearCfg, true).get(); + ctx.cache().dynamicStartCache(null, cacheName, nearCfg, true, true).get(); IgniteCacheProxy cache = ctx.cache().publicJCache(cacheName); @@ -2399,10 +2399,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable { IgniteInternalCache internalCache = ctx.cache().cache(cacheName); if (internalCache == null) - ctx.cache().dynamicStartCache(null, cacheName, nearCfg, false).get(); + ctx.cache().dynamicStartCache(null, cacheName, nearCfg, false, true).get(); else { if (internalCache.configuration().getNearConfiguration() == null) - ctx.cache().dynamicStartCache(null, cacheName, nearCfg, false).get(); + ctx.cache().dynamicStartCache(null, cacheName, nearCfg, false, true).get(); } IgniteCacheProxy cache = ctx.cache().publicJCache(cacheName); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bb73b66c/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 e6a0994..ac2d7b1 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 @@ -1458,6 +1458,8 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (clientNodeStart && !affNodeStart) { if (nearCfg != null) ccfg.setNearConfiguration(nearCfg); + else + ccfg.setNearConfiguration(null); } CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg); @@ -1746,7 +1748,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { public IgniteInternalFuture createFromTemplate(String cacheName) { CacheConfiguration cfg = createConfigFromTemplate(cacheName); - return dynamicStartCache(cfg, cacheName, null, true); + return dynamicStartCache(cfg, cacheName, null, true, true); } /** @@ -1762,7 +1764,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { CacheConfiguration cfg = createConfigFromTemplate(cacheName); - return dynamicStartCache(cfg, cacheName, null, false); + return dynamicStartCache(cfg, cacheName, null, false, true); } catch (IgniteCheckedException e) { return new GridFinishedFuture<>(e); @@ -1855,9 +1857,10 @@ public class GridCacheProcessor extends GridProcessorAdapter { @Nullable CacheConfiguration ccfg, String cacheName, @Nullable NearCacheConfiguration nearCfg, - boolean failIfExists + boolean failIfExists, + boolean failIfNotStarted ) { - return dynamicStartCache(ccfg, cacheName, nearCfg, CacheType.USER, failIfExists); + return dynamicStartCache(ccfg, cacheName, nearCfg, CacheType.USER, failIfExists, failIfNotStarted); } /** @@ -1875,12 +1878,11 @@ public class GridCacheProcessor extends GridProcessorAdapter { String cacheName, @Nullable NearCacheConfiguration nearCfg, CacheType cacheType, - boolean failIfExists + boolean failIfExists, + boolean failIfNotStarted ) { checkEmptyTransactions(); - assert ccfg != null || nearCfg != null; - DynamicCacheDescriptor desc = registeredCaches.get(maskNull(cacheName)); DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(cacheName, ctx.localNodeId()); @@ -1947,9 +1949,13 @@ public class GridCacheProcessor extends GridProcessorAdapter { if (desc != null && !desc.cancelled()) ccfg = desc.cacheConfiguration(); - if (ccfg == null) - return new GridFinishedFuture<>(new CacheExistsException("Failed to start client cache " + - "(a cache with the given name is not started): " + cacheName)); + if (ccfg == null) { + if (failIfNotStarted) + return new GridFinishedFuture<>(new CacheExistsException("Failed to start client cache " + + "(a cache with the given name is not started): " + cacheName)); + else + return new GridFinishedFuture<>(); + } if (CU.affinityNode(ctx.discovery().localNode(), ccfg.getNodeFilter())) { if (ccfg.getNearConfiguration() != null) @@ -1961,6 +1967,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { req.deploymentId(desc.deploymentId()); req.startCacheConfiguration(ccfg); + } if (nearCfg != null) @@ -2528,7 +2535,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { IgniteCacheProxy cache = jCacheProxies.get(masked); if (cache == null) { - dynamicStartCache(null, name, null, false); + dynamicStartCache(null, name, null, false, false); cache = jCacheProxies.get(masked); } @@ -2644,7 +2651,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { throw new IllegalStateException("Failed to get cache because it is a system cache: " + cacheName); if (cache == null) { - dynamicStartCache(null, cacheName, null, false).get(); + dynamicStartCache(null, cacheName, null, false, failIfNotStarted).get(); cache = jCacheProxies.get(masked); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bb73b66c/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java index 473a2ac..dcd22cd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java @@ -819,7 +819,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter { CacheConfiguration newCfg = cacheConfiguration(cfg, cacheName); - ctx.cache().dynamicStartCache(newCfg, cacheName, null, CacheType.INTERNAL, false).get(); + ctx.cache().dynamicStartCache(newCfg, cacheName, null, CacheType.INTERNAL, false, true).get(); return cacheName; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bb73b66c/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 7905565..7d00417 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 @@ -143,7 +143,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { ccfg.setName(DYNAMIC_CACHE_NAME); - futs.add(kernal.context().cache().dynamicStartCache(ccfg, ccfg.getName(), null, true)); + futs.add(kernal.context().cache().dynamicStartCache(ccfg, ccfg.getName(), null, true, true)); return null; } @@ -203,7 +203,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { IgniteEx kernal = grid(ThreadLocalRandom.current().nextInt(nodeCount())); - futs.add(kernal.context().cache().dynamicStartCache(ccfg, ccfg.getName(), null, true)); + futs.add(kernal.context().cache().dynamicStartCache(ccfg, ccfg.getName(), null, true, true)); return null; }