You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/18 07:33:49 UTC
[2/3] ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-5075-cacheStart' into ignite-5075
Merge remote-tracking branch 'remotes/origin/ignite-5075-cacheStart' into ignite-5075
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a6788090
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a6788090
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a6788090
Branch: refs/heads/ignite-5075
Commit: a67880902bf7719768022e46615a5997d628eba5
Parents: f974c53 2724fcb
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 18 10:05:22 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 18 10:05:22 2017 +0300
----------------------------------------------------------------------
.../internal/processors/cache/CacheAffinitySharedManager.java | 5 +++--
modules/core/src/test/config/examples.properties | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6788090/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index c2dbf61,cec42a8..e599344
--- 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
@@@ -410,77 -427,52 +410,77 @@@ public class CacheAffinitySharedManager
}
}
}
- else
- initStartedCacheOnCoordinator(fut, cacheDesc.cacheId());
}
- for (DynamicCacheChangeRequest req : exchActions.closeRequests(cctx.localNodeId())) {
- Integer cacheId = CU.cacheId(req.cacheName());
+ List<ExchangeActions.ActionData> closeReqs = exchActions.closeRequests(cctx.localNodeId());
- cctx.cache().blockGateway(req);
+ for (ExchangeActions.ActionData req : closeReqs) {
+ cctx.cache().blockGateway(req.request());
if (crd) {
- GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
+ CacheGroupInfrastructure grp = cctx.cache().cacheGroup(req.descriptor().groupDescriptor().groupId());
+
+ assert grp != null;
+
+ if (grp.affinityNode())
+ continue;
- // Client cache was stopped, need create 'client' CacheHolder.
- if (cacheCtx != null && !cacheCtx.affinityNode()) {
- CacheHolder cache = caches.remove(cacheId);
+ boolean grpClosed = false;
- assert !cache.client() : cache;
+ if (grp.sharedGroup()) {
+ boolean cacheRemaining = false;
- cache = CacheHolder2.create(cctx,
- cctx.cache().cacheDescriptor(cacheId),
- fut,
- cache.affinity());
+ for (GridCacheContext ctx : cctx.cacheContexts()) {
+ if (ctx.group() == grp && !cacheClosed(ctx.cacheId(), closeReqs)) {
+ cacheRemaining = true;
- caches.put(cacheId, cache);
+ break;
+ }
+ }
+
+ if (!cacheRemaining)
+ grpClosed = true;
}
- }
- }
+ else
+ grpClosed = true;
- Set<Integer> stoppedCaches = null;
+ // All client cache groups were stopped, need create 'client' CacheGroupHolder.
+ if (grpClosed) {
+ CacheGroupHolder grpHolder = grpHolders.remove(grp.groupId());
- for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
- DynamicCacheDescriptor desc = action.descriptor();
+ if (grpHolder != null) {
+ assert !grpHolder.client() : grpHolder;
+
+ grpHolder = CacheGroupHolder2.create(cctx,
+ registeredGrps.get(grp.groupId()),
+ fut,
+ grp.affinity());
+
+ grpHolders.put(grp.groupId(), grpHolder);
+ }
+ }
+ }
+ }
+ for (ExchangeActions.ActionData action : exchActions.cacheStopRequests())
cctx.cache().blockGateway(action.request());
- if (crd && lateAffAssign && desc.cacheConfiguration().getCacheMode() != LOCAL) {
- CacheHolder cache = caches.remove(desc.cacheId());
+ Set<Integer> stoppedGrps = null;
+
- if (crd) {
++ if (crd && lateAffAssign) {
+ for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop()) {
+ if (grpDesc.config().getCacheMode() != LOCAL) {
+ CacheGroupHolder cacheGrp = grpHolders.remove(grpDesc.groupId());
- assert cache != null : action.request();
+ assert cacheGrp != null : grpDesc;
- if (stoppedCaches == null)
- stoppedCaches = new HashSet<>();
+ if (stoppedGrps == null)
+ stoppedGrps = new HashSet<>();
- stoppedCaches.add(cache.cacheId());
+ stoppedGrps.add(cacheGrp.groupId());
- cctx.io().removeHandler(desc.cacheId(), GridDhtAffinityAssignmentResponse.class);
+ cctx.io().removeHandler(true, cacheGrp.groupId(), GridDhtAffinityAssignmentResponse.class);
+ }
}
}
@@@ -1741,20 -1730,21 +1741,21 @@@
* @return Cache holder.
* @throws IgniteCheckedException If failed.
*/
- static CacheHolder2 create(
+ static CacheGroupHolder2 create(
GridCacheSharedContext cctx,
- DynamicCacheDescriptor cacheDesc,
+ CacheGroupDescriptor grpDesc,
GridDhtPartitionsExchangeFuture fut,
@Nullable GridAffinityAssignmentCache initAff) throws IgniteCheckedException {
- assert cacheDesc != null;
+ assert grpDesc != null;
assert !cctx.kernalContext().clientNode();
- CacheConfiguration<?, ?> ccfg = cacheDesc.cacheConfiguration();
+ CacheConfiguration<?, ?> ccfg = grpDesc.config();
- assert ccfg != null : cacheDesc;
+ assert ccfg != null : grpDesc;
assert ccfg.getCacheMode() != LOCAL : ccfg.getName();
- assert !cctx.discovery().cacheGroupAffinityNodes(grpDesc.groupId(), fut.topologyVersion()).contains(cctx.localNode());
- assert !cctx.discovery().cacheAffinityNodes(ccfg.getName(),
++ assert !cctx.discovery().cacheGroupAffinityNodes(grpDesc.groupId(),
+ fut.topologyVersion()).contains(cctx.localNode()) : cacheDesc.cacheName();
AffinityFunction affFunc = cctx.cache().clone(ccfg.getAffinity());