IGNITE-180 - Fixed awaitPartitionMap for dynamically started cache.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fd011e28 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fd011e28 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fd011e28 Branch: refs/heads/ignite-30 Commit: fd011e282fd818ff3cab1bda94fd236207bb8779 Parents: beedb17 Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Tue Apr 7 17:09:51 2015 -0700 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Tue Apr 7 17:09:51 2015 -0700 ---------------------------------------------------------------------- .../dht/GridClientPartitionTopology.java | 6 ++--- .../dht/GridDhtPartitionTopologyImpl.java | 6 ++--- .../cache/IgniteDynamicCacheStartSelfTest.java | 23 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fd011e28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java index 4640192..331de4e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java @@ -220,21 +220,21 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology { // If this is the oldest node. if (oldest.id().equals(loc.id()) || exchFut.isCacheAdded(cacheId)) { if (node2part == null) { - node2part = new GridDhtPartitionFullMap(loc.id(), loc.order(), updateSeq); + node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq); if (log.isDebugEnabled()) log.debug("Created brand new full topology map on oldest node [exchId=" + exchId + ", fullMap=" + fullMapString() + ']'); } else if (!node2part.valid()) { - node2part = new GridDhtPartitionFullMap(loc.id(), loc.order(), updateSeq, node2part, false); + node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false); if (log.isDebugEnabled()) log.debug("Created new full topology map on oldest node [exchId=" + exchId + ", fullMap=" + node2part + ']'); } else if (!node2part.nodeId().equals(loc.id())) { - node2part = new GridDhtPartitionFullMap(loc.id(), loc.order(), updateSeq, node2part, false); + node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false); if (log.isDebugEnabled()) log.debug("Copied old map into new map on oldest node (previous oldest node left) [exchId=" + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fd011e28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java index 30b4c80..073e0e7 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java @@ -249,21 +249,21 @@ class GridDhtPartitionTopologyImpl<K, V> implements GridDhtPartitionTopology { // If this is the oldest node. if (oldest.id().equals(loc.id()) || exchFut.isCacheAdded(cctx.cacheId())) { if (node2part == null) { - node2part = new GridDhtPartitionFullMap(loc.id(), loc.order(), updateSeq); + node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq); if (log.isDebugEnabled()) log.debug("Created brand new full topology map on oldest node [exchId=" + exchId + ", fullMap=" + fullMapString() + ']'); } else if (!node2part.valid()) { - node2part = new GridDhtPartitionFullMap(loc.id(), loc.order(), updateSeq, node2part, false); + node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false); if (log.isDebugEnabled()) log.debug("Created new full topology map on oldest node [exchId=" + exchId + ", fullMap=" + node2part + ']'); } else if (!node2part.nodeId().equals(loc.id())) { - node2part = new GridDhtPartitionFullMap(loc.id(), loc.order(), updateSeq, node2part, false); + node2part = new GridDhtPartitionFullMap(oldest.id(), oldest.order(), updateSeq, node2part, false); if (log.isDebugEnabled()) log.debug("Copied old map into new map on oldest node (previous oldest node left) [exchId=" + http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fd011e28/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 b83924b25..32809e6 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 @@ -997,4 +997,27 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { daemon = false; } } + + /** + * @throws Exception If failed. + */ + public void testAwaitPartitionMapExchange() throws Exception { + try (IgniteCache ignored = grid(0).getOrCreateCache(new CacheConfiguration(DYNAMIC_CACHE_NAME))) { + awaitPartitionMapExchange(); + + startGrid(nodeCount()); + + awaitPartitionMapExchange(); + + startGrid(nodeCount() + 1); + + awaitPartitionMapExchange(); + + stopGrid(nodeCount() + 1); + + awaitPartitionMapExchange(); + + stopGrid(nodeCount()); + } + } }