ignite-gg-11650 Stabilize 8.0.2.ea1 branch after merging activation/deactivation fix restore memory issue
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1ac93f0c Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1ac93f0c Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1ac93f0c Branch: refs/heads/ignite-3477 Commit: 1ac93f0c94cfd5546a9446035e6f5f3975e43a8c Parents: a290fdd Author: Dmitriy Govorukhin <[email protected]> Authored: Tue Dec 20 15:42:17 2016 +0300 Committer: Dmitriy Govorukhin <[email protected]> Committed: Tue Dec 20 15:42:17 2016 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheProcessor.java | 23 ++++------ .../GridDhtPartitionsExchangeFuture.java | 10 ++--- .../cluster/GridClusterStateProcessor.java | 45 +++++++++++++++----- 3 files changed, 48 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/1ac93f0c/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 518fd18..3834189 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 @@ -734,6 +734,14 @@ public class GridCacheProcessor extends GridProcessorAdapter { try { checkConsistency(); + //must be here, because we must start database before start first cache + if (activeOnStart) { + if (!ctx.clientNode()) + sharedCtx.database().lock(); + + sharedCtx.database().onKernalStart(false); + } + // Start dynamic caches received from collect discovery data. for (DynamicCacheDescriptor desc : registeredCaches.values()) { if (ctx.config().isDaemon() && !CU.isMarshallerCache(desc.cacheConfiguration().getName())) @@ -779,22 +787,9 @@ public class GridCacheProcessor extends GridProcessorAdapter { cacheStartedLatch.countDown(); } - if (activeOnStart) { - //todo not used explicit lock - if (!ctx.clientNode()) - sharedCtx.database().lock(); - - sharedCtx.wal().onKernalStart(false); - - if (sharedCtx.pageStore() != null) - sharedCtx.pageStore().onKernalStart(false); - - sharedCtx.database().onKernalStart(false); - } - // Must call onKernalStart on shared managers after creation of fetched caches. for (GridCacheSharedManager<?, ?> mgr : sharedCtx.managers()) - if (sharedCtx.database() != mgr && sharedCtx.wal() != mgr && sharedCtx.pageStore() != mgr) + if (sharedCtx.database() != mgr) mgr.onKernalStart(false); if (!activeOnStart) http://git-wip-us.apache.org/repos/asf/ignite/blob/1ac93f0c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java index dadcda4..81ba317 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java @@ -651,17 +651,17 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT private ExchangeType onCacheChangeRequest(boolean crd) throws IgniteCheckedException { assert !F.isEmpty(reqs) : this; - boolean clientOnly = cctx.affinity().onCacheChangeRequest(this, crd, reqs); - GridClusterStateProcessor stateProc = cctx.kernalContext().state(); - if (exchangeOnChangeGlobalState = stateProc.changeGlobalState(reqs, topologyVersion())){ + if (exchangeOnChangeGlobalState = stateProc.changeGlobalState(reqs, topologyVersion())) { changeGlobalStateException = stateProc.onChangeGlobalState(); if (crd && changeGlobalStateException != null) changeGlobalStateExceptions.put(cctx.localNodeId(), changeGlobalStateException); } + boolean clientOnly = cctx.affinity().onCacheChangeRequest(this, crd, reqs); + if (clientOnly) { boolean clientCacheStarted = false; @@ -1393,9 +1393,9 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT if (exchangeOnChangeGlobalState && msg.getException() != null) changeGlobalStateExceptions.put(node.id(), msg.getException()); - } - allReceived = remaining.isEmpty(); + allReceived = remaining.isEmpty(); + } } else singleMsgs.put(node, msg); http://git-wip-us.apache.org/repos/asf/ignite/blob/1ac93f0c/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java index f42a8ba..18e4a1c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java @@ -34,6 +34,7 @@ import org.apache.ignite.IgniteCompute; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.cluster.ClusterNode; +import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.events.DiscoveryEvent; import org.apache.ignite.events.Event; import org.apache.ignite.internal.GridKernalContext; @@ -421,12 +422,26 @@ public class GridClusterStateProcessor extends GridProcessorAdapter { log.info("Start activation process [nodeId=" + this.ctx.localNodeId() + ", client=" + client + ", topVer=" + cgsCtx.topVer + "]"); + Collection<CacheConfiguration> cfgs = new ArrayList<>(); + + for (DynamicCacheChangeRequest req : cgsCtx.batch.requests()) + if (req.startCacheConfiguration() != null) + cfgs.add(req.startCacheConfiguration()); + try { if (!client) { sharedCtx.database().lock(); sharedCtx.wal().onActivate(ctx); + for (CacheConfiguration cfg : cfgs) + if (CU.isSystemCache(cfg.getName())) + sharedCtx.pageStore().initializeForCache(cfg); + + for (CacheConfiguration cfg : cfgs) + if (!CU.isSystemCache(cfg.getName())) + sharedCtx.pageStore().initializeForCache(cfg); + sharedCtx.database().onActivate(ctx); if (sharedCtx.pageStore() != null) @@ -465,15 +480,6 @@ public class GridClusterStateProcessor extends GridProcessorAdapter { ctx.service().onDeActivate(ctx); - if (!client) { - sharedCtx.database().onDeActivate(ctx); - - if (sharedCtx.pageStore() != null) - sharedCtx.pageStore().onDeActivate(ctx); - - sharedCtx.wal().onDeActivate(ctx); - } - if (log.isInfoEnabled()) log.info("Success deactivate services, dataStructures, database, pageStore, wal [id=" + ctx.localNodeId() + ", client=" + client + ", topVer=" + cgsCtx.topVer + "]"); @@ -547,9 +553,26 @@ public class GridClusterStateProcessor extends GridProcessorAdapter { log.info("Success final deactivate [nodeId=" + ctx.localNodeId() + ", client=" + client + ", topVer=" + cgsCtx.topVer + "]"); - globalState = INACTIVE; + Exception ex = null; + + try { + if (!client) { + sharedCtx.database().onDeActivate(ctx); + + if (sharedCtx.pageStore() != null) + sharedCtx.pageStore().onDeActivate(ctx); + + sharedCtx.wal().onDeActivate(ctx); + } + } + catch (Exception e) { + ex = e; + } + finally { + globalState = INACTIVE; + } - sendChangeGlobalStateResponse(cgsCtx.requestId, cgsCtx.initiatingNodeId, null); + sendChangeGlobalStateResponse(cgsCtx.requestId, cgsCtx.initiatingNodeId, ex); this.lastCgsCtx = null; }
