Repository: ignite
Updated Branches:
  refs/heads/master 1cc333266 -> 7fb606142


IGNITE-7689 Corrected awaitPartitionMapExchange to prevent assertion on 
readyTopologyVersion() access


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7fb60614
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7fb60614
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7fb60614

Branch: refs/heads/master
Commit: 7fb6061421432aefd40aec3fde3a49c55fec968b
Parents: 1cc3332
Author: Alexey Goncharuk <alexey.goncha...@gmail.com>
Authored: Wed Feb 14 11:52:04 2018 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Wed Feb 14 11:52:04 2018 +0300

----------------------------------------------------------------------
 .../distributed/CacheBaselineTopologyTest.java  |  2 ++
 .../junits/common/GridCommonAbstractTest.java   | 20 +++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7fb60614/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
index 21aedf1..26502ed 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheBaselineTopologyTest.java
@@ -602,6 +602,8 @@ public class CacheBaselineTopologyTest extends 
GridCommonAbstractTest {
 
         stopGrid(primaryIdx, false);
 
+        backup.context().cache().context().exchange().affinityReadyFuture(new 
AffinityTopologyVersion(5, 0)).get();
+
         assertEquals(backup.localNode(), 
ig.affinity(CACHE_NAME).mapKeyToNode(key));
 
         cache.put(key, val2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/7fb60614/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index 1cf1ada..17c2502 100755
--- 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.testframework.junits.common;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -71,6 +70,7 @@ import 
org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan;
 import org.apache.ignite.internal.processors.cache.GridCacheFuture;
+import 
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter;
@@ -88,7 +88,6 @@ import 
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
 import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord;
 import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
 import 
org.apache.ignite.internal.processors.cache.verify.VerifyBackupPartitionsTask;
-import org.apache.ignite.internal.util.IgniteUtils;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
@@ -642,7 +641,22 @@ public abstract class GridCommonAbstractTest extends 
GridAbstractTest {
                         for (int i = 0; ; i++) {
                             boolean match = false;
 
-                            AffinityTopologyVersion readyVer = 
dht.context().shared().exchange().readyAffinityVersion();
+                            GridCachePartitionExchangeManager<?, ?> exchMgr = 
dht.context().shared().exchange();
+
+                            AffinityTopologyVersion readyVer = 
exchMgr.readyAffinityVersion();
+
+                            // Wait for the exchange completion (there is a 
race between ready affinity version
+                            // initialization and partition topology version 
update).
+                            // Otherwise, there may be an assertion when 
printing top.readyTopologyVersion().
+                            try {
+                                IgniteInternalFuture<?> fut = 
exchMgr.affinityReadyFuture(readyVer);
+
+                                if (fut != null)
+                                    fut.get();
+                            }
+                            catch (IgniteCheckedException e) {
+                                throw new IgniteException(e);
+                            }
 
                             if (readyVer.topologyVersion() > 0 && 
c.context().started()) {
                                 // Must map on updated version of topology.

Reply via email to