IGNITE-6512 Negated flag for inactive state caches start - Fixes #2910. Signed-off-by: Alexey Goncharuk <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/be8787a6 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/be8787a6 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/be8787a6 Branch: refs/heads/ignite-5937 Commit: be8787a642dfffe802cb63b7069ca5a9757ac76f Parents: 3be007f Author: EdShangGG <[email protected]> Authored: Mon Oct 23 20:31:15 2017 +0300 Committer: Alexey Goncharuk <[email protected]> Committed: Mon Oct 23 20:31:15 2017 +0300 ---------------------------------------------------------------------- .../cache/CacheAffinitySharedManager.java | 4 +-- .../cache/DynamicCacheChangeRequest.java | 13 +++---- .../processors/cache/GridCacheProcessor.java | 38 ++++++++++---------- 3 files changed, 28 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/be8787a6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java index 7266f99..efcb501 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java @@ -429,7 +429,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap desc, startReq.nearCacheConfiguration(), topVer, - startReq.activeAfterStart()); + startReq.disabledAfterStart()); startedInfos.put(desc.cacheId(), startReq.nearCacheConfiguration() != null); @@ -753,7 +753,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap cacheDesc, nearCfg, evts.topologyVersion(), - req.activeAfterStart()); + req.disabledAfterStart()); if (fut.cacheAddedOnExchange(cacheDesc.cacheId(), cacheDesc.receivedFrom())) { if (fut.events().discoveryCache().cacheGroupAffinityNodes(cacheDesc.groupId()).isEmpty()) http://git-wip-us.apache.org/repos/asf/ignite/blob/be8787a6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java index cfc2d07..3ee5903 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheChangeRequest.java @@ -69,7 +69,7 @@ public class DynamicCacheChangeRequest implements Serializable { private boolean restart; /** Cache active on start or not*/ - private boolean activeAfterStart = true; + private boolean disabledAfterStart; /** Destroy. */ private boolean destroy; @@ -410,15 +410,15 @@ public class DynamicCacheChangeRequest implements Serializable { /** * @return state of cache after start */ - public boolean activeAfterStart() { - return activeAfterStart; + public boolean disabledAfterStart() { + return disabledAfterStart; } /** - * @param activeAfterStart state of cache after start + * @param disabledAfterStart state of cache after start */ - public void activeAfterStart(boolean activeAfterStart) { - this.activeAfterStart = activeAfterStart; + public void disabledAfterStart(boolean disabledAfterStart) { + this.disabledAfterStart = disabledAfterStart; } /** {@inheritDoc} */ @@ -429,6 +429,7 @@ public class DynamicCacheChangeRequest implements Serializable { ", clientStartOnly=" + clientStartOnly + ", stop=" + stop + ", destroy=" + destroy + + ", disabledAfterStart" + disabledAfterStart + ']'; } } http://git-wip-us.apache.org/repos/asf/ignite/blob/be8787a6/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 d4d65dc..021807a 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 @@ -1292,7 +1292,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param cacheObjCtx Cache object context. * @param affNode {@code True} if local node affinity node. * @param updatesAllowed Updates allowed flag. - * @param activeOnStart If true, then we will discard restarting state from proxies. If false then we will change + * @param disabledAfterStart If true, then we will discard restarting state from proxies. If false then we will change * state of proxies to restarting * @return Cache context. * @throws IgniteCheckedException If failed to create cache. @@ -1305,7 +1305,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { CacheObjectContext cacheObjCtx, boolean affNode, boolean updatesAllowed, - boolean activeOnStart) + boolean disabledAfterStart) throws IgniteCheckedException { assert cfg != null; @@ -1464,7 +1464,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { } } - cache.active(activeOnStart); + cache.active(!disabledAfterStart); cacheCtx.cache(cache); @@ -1688,7 +1688,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { desc, t.get2(), exchTopVer, - true); + false); } } } @@ -1722,7 +1722,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { desc, null, exchTopVer, - true); + false); } } @@ -1734,7 +1734,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param desc Cache descriptor. * @param reqNearCfg Near configuration if specified for client cache start request. * @param exchTopVer Current exchange version. - * @param activeOnStart If true, then we will discard restarting state from proxies. If false then we will change + * @param disabledAfterStart If true, then we will discard restarting state from proxies. If false then we will change * state of proxies to restarting * @throws IgniteCheckedException If failed. */ @@ -1743,7 +1743,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { DynamicCacheDescriptor desc, @Nullable NearCacheConfiguration reqNearCfg, AffinityTopologyVersion exchTopVer, - boolean activeOnStart + boolean disabledAfterStart ) throws IgniteCheckedException { assert !caches.containsKey(startCfg.getName()) : startCfg.getName(); @@ -1808,7 +1808,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { cacheObjCtx, affNode, true, - activeOnStart + disabledAfterStart ); cacheCtx.dynamicDeploymentId(desc.deploymentId()); @@ -1827,7 +1827,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { IgniteCacheProxyImpl<?, ?> proxy = jCacheProxies.get(ccfg.getName()); - if (activeOnStart && proxy != null && proxy.isRestarting()) + if (!disabledAfterStart && proxy != null && proxy.isRestarting()) proxy.onRestarted(cacheCtx, cache); } @@ -2546,7 +2546,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { sql, failIfExists, failIfNotStarted, - true); + false); if (req != null) { if (req.clientStartOnly()) @@ -2593,12 +2593,12 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param ccfgList Collection of cache configuration. * @param failIfExists Fail if exists flag. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. - * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}. + * @param disabledAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}. * @return Future that will be completed when all caches are deployed. */ public IgniteInternalFuture<?> dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists, - boolean checkThreadTx, boolean activeAfterStart) { - return dynamicStartCaches(ccfgList, null, failIfExists, checkThreadTx, activeAfterStart); + boolean checkThreadTx, boolean disabledAfterStart) { + return dynamicStartCaches(ccfgList, null, failIfExists, checkThreadTx, disabledAfterStart); } /** @@ -2608,7 +2608,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param cacheType Cache type. * @param failIfExists Fail if exists flag. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. - * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}. + * @param disabledAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}. * @return Future that will be completed when all caches are deployed. */ private IgniteInternalFuture<?> dynamicStartCaches( @@ -2616,7 +2616,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { CacheType cacheType, boolean failIfExists, boolean checkThreadTx, - boolean activeAfterStart + boolean disabledAfterStart ) { if (checkThreadTx) checkEmptyTransactions(); @@ -2645,7 +2645,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { false, failIfExists, true, - activeAfterStart); + disabledAfterStart); if (req != null) { if (req.clientStartOnly()) { @@ -3807,7 +3807,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { * @param sql Whether the cache needs to be created as the result of SQL {@code CREATE TABLE} command. * @param failIfExists Fail if exists flag. * @param failIfNotStarted If {@code true} fails if cache is not started. - * @param activeAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}. + * @param disabledAfterStart If true, cache proxies will be only activated after {@link #restartProxies()}. * @return Request or {@code null} if cache already exists. * @throws IgniteCheckedException if some of pre-checks failed * @throws CacheExistsException if cache exists and failIfExists flag is {@code true} @@ -3820,7 +3820,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { boolean sql, boolean failIfExists, boolean failIfNotStarted, - boolean activeAfterStart + boolean disabledAfterStart ) throws IgniteCheckedException { DynamicCacheDescriptor desc = cacheDescriptor(cacheName); @@ -3830,7 +3830,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { req.failIfExists(failIfExists); - req.activeAfterStart(activeAfterStart); + req.disabledAfterStart(disabledAfterStart); if (ccfg != null) { cloneCheckSerializable(ccfg);
