Repository: ignite Updated Branches: refs/heads/ignite-1027 82947c75e -> 09a2415d7
ignite-1027 Fixed early rebalance sync future completion. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/09a2415d Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/09a2415d Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/09a2415d Branch: refs/heads/ignite-1027 Commit: 09a2415d71c19bb7df000b2213158c139e981233 Parents: 82947c7 Author: sboikov <[email protected]> Authored: Thu Dec 3 09:37:09 2015 +0300 Committer: sboikov <[email protected]> Committed: Thu Dec 3 09:37:09 2015 +0300 ---------------------------------------------------------------------- .../GridCachePartitionExchangeManager.java | 9 ++--- .../dht/preloader/GridDhtPartitionDemander.java | 2 +- .../dht/GridCacheDhtPreloadDelayedSelfTest.java | 37 +++++++++++++------- 3 files changed, 31 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/09a2415d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java index 9142480..a0f7f93 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java @@ -1349,12 +1349,13 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana for (GridCacheContext cacheCtx : cctx.cacheContexts()) { long delay = cacheCtx.config().getRebalanceDelay(); + GridDhtPreloaderAssignments assigns = null; + // Don't delay for dummy reassigns to avoid infinite recursion. - if (delay == 0 || forcePreload) { - GridDhtPreloaderAssignments assigns = cacheCtx.preloader().assign(exchFut); + if (delay == 0 || forcePreload) + assigns = cacheCtx.preloader().assign(exchFut); - assignsMap.put(cacheCtx.cacheId(), assigns); - } + assignsMap.put(cacheCtx.cacheId(), assigns); } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/09a2415d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java index b46979db..ced0d10 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java @@ -1019,7 +1019,7 @@ public class GridDhtPartitionDemander { preloadEvent(EVT_CACHE_REBALANCE_STOPPED, exchFut.discoveryEvent()); if (log.isDebugEnabled()) - log.debug("Completed rebalance future."); + log.debug("Completed rebalance future: " + this); cctx.shared().exchange().scheduleResendPartitions(); http://git-wip-us.apache.org/repos/asf/ignite/blob/09a2415d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java index 9d6e82f..0b610f3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java @@ -22,7 +22,6 @@ import java.util.Collection; import java.util.Map; import java.util.UUID; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CachePeekMode; @@ -35,7 +34,6 @@ import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.events.Event; import org.apache.ignite.events.EventType; -import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap2; @@ -51,6 +49,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheRebalanceMode.ASYNC; @@ -107,7 +106,9 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { stopAllGrids(); } - /** @throws Exception If failed. */ + /** + * @throws Exception If failed. + */ public void testManualPreload() throws Exception { delay = -1; @@ -184,7 +185,9 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { checkCache(c2, cnt); } - /** @throws Exception If failed. */ + /** + * @throws Exception If failed. + */ public void testDelayedPreload() throws Exception { delay = PRELOAD_DELAY; @@ -238,9 +241,9 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { checkMaps(false, d0, d1, d2); - assert l1.await(PRELOAD_DELAY * 3 / 2, TimeUnit.MILLISECONDS); + assert l1.await(PRELOAD_DELAY * 3 / 2, MILLISECONDS); - assert l2.await(PRELOAD_DELAY * 3 / 2, TimeUnit.MILLISECONDS); + assert l2.await(PRELOAD_DELAY * 3 / 2, MILLISECONDS); U.sleep(1000); @@ -253,7 +256,9 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { checkCache(c2, cnt); } - /** @throws Exception If failed. */ + /** + * @throws Exception If failed. + */ public void testAutomaticPreload() throws Exception { delay = 0; preloadMode = CacheRebalanceMode.SYNC; @@ -284,7 +289,9 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { checkCache(c2, cnt); } - /** @throws Exception If failed. */ + /** + * @throws Exception If failed. + */ public void testAutomaticPreloadWithEmptyCache() throws Exception { preloadMode = SYNC; @@ -331,7 +338,9 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { } } - /** @throws Exception If failed. */ + /** + * @throws Exception If failed. + */ public void testManualPreloadSyncMode() throws Exception { preloadMode = CacheRebalanceMode.SYNC; delay = -1; @@ -344,7 +353,9 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { } } - /** @throws Exception If failed. */ + /** + * @throws Exception If failed. + */ public void testPreloadManyNodes() throws Exception { delay = 0; preloadMode = ASYNC; @@ -419,9 +430,11 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest { * * @param strict Strict check flag. * @param caches Maps to compare. + * @throws Exception If failed. */ - private void checkMaps(final boolean strict, final GridDhtCacheAdapter<String, Integer>... caches) - throws IgniteInterruptedCheckedException { + @SafeVarargs + private final void checkMaps(final boolean strict, final GridDhtCacheAdapter<String, Integer>... caches) + throws Exception { if (caches.length < 2) return;
