Repository: ignite Updated Branches: refs/heads/ignite-1537 21ea9f1d2 -> 0adfd928b
ignite-647 Fixed issues with dynamic cache start when fair affinity is used Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0adfd928 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0adfd928 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0adfd928 Branch: refs/heads/ignite-1537 Commit: 0adfd928b6b6ae6f8000232c2f82b8b51613560e Parents: 21ea9f1 Author: sboikov <sboi...@gridgain.com> Authored: Wed Dec 23 16:51:12 2015 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Wed Dec 23 16:51:12 2015 +0300 ---------------------------------------------------------------------- .../GridDhtPartitionsExchangeFuture.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/0adfd928/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 a6ff51f..a10294f 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 @@ -329,6 +329,19 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT * @return {@code True} if cache was added during this exchange. */ public boolean isCacheAdded(int cacheId, AffinityTopologyVersion topVer) { + if (cacheStarted(cacheId)) + return true; + + GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId); + + return cacheCtx != null && F.eq(cacheCtx.startTopologyVersion(), topVer); + } + + /** + * @param cacheId Cache ID. + * @return {@code True} if non-client cache was added during this exchange. + */ + private boolean cacheStarted(int cacheId) { if (!F.isEmpty(reqs)) { for (DynamicCacheChangeRequest req : reqs) { if (req.start() && !req.clientStartOnly()) { @@ -338,9 +351,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT } } - GridCacheContext<?, ?> cacheCtx = cctx.cacheContext(cacheId); - - return cacheCtx != null && F.eq(cacheCtx.startTopologyVersion(), topVer); + return false; } /** @@ -419,7 +430,7 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT // If local node did not initiate exchange or local node is the only cache node in grid. Collection<ClusterNode> affNodes = CU.affinityNodes(cacheCtx, exchId.topologyVersion()); - return exchId.topologyVersion().equals(cacheCtx.startTopologyVersion()) || + return cacheStarted(cacheCtx.cacheId()) || !exchId.nodeId().equals(cctx.localNodeId()) || (affNodes.size() == 1 && affNodes.contains(cctx.localNode())); }