You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2018/03/23 17:54:51 UTC
ignite git commit: IGNITE-7969 Wrong 'wait for topology version'
routine fixed
Repository: ignite
Updated Branches:
refs/heads/master a3e32ca61 -> 9f8f366ad
IGNITE-7969 Wrong 'wait for topology version' routine fixed
Signed-off-by: Andrey Gura <ag...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9f8f366a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9f8f366a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9f8f366a
Branch: refs/heads/master
Commit: 9f8f366ad96d1a0c29778eef5c74653190e4675d
Parents: a3e32ca
Author: Aleksey Plekhanov <pl...@gmail.com>
Authored: Fri Mar 23 20:51:31 2018 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Fri Mar 23 20:51:31 2018 +0300
----------------------------------------------------------------------
...niteTopologyValidatorGridSplitCacheTest.java | 12 +++--
.../IgniteCacheTopologySplitAbstractTest.java | 49 +++++++++++++++-----
2 files changed, 45 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9f8f366a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
index 1885e9a..c315ba5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
@@ -53,7 +53,6 @@ import static org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.DFLT_PORT;
* activator node'll enter a topology, enabling grid operations.
*/
public class IgniteTopologyValidatorGridSplitCacheTest extends IgniteCacheTopologySplitAbstractTest {
-
/** */
private static final String DC_NODE_ATTR = "dc";
@@ -454,8 +453,8 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends IgniteCacheTopolo
putCnt++;
}
catch (Throwable t) {
- IgniteException e = new IgniteException("Failed to put entry [cache=" + cacheName + ", key=" +
- key + ']', t);
+ IgniteException e = new IgniteException("Failed to put entry [gridIdx=" + idx + ", cache=" +
+ cacheName + ", key=" + key + ']', t);
log.error(e.getMessage(), e.getCause());
@@ -498,6 +497,11 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends IgniteCacheTopolo
ex = new IgniteException("Failed to put entry");
ex.addSuppressed(e);
+
+ if (putCnt != 0) {
+ throw new AssertionError("Failure after successful tryPut [gridIdx=" + idx +
+ ", successful puts = " + putCnt + ']', ex);
+ }
}
}
}
@@ -682,4 +686,4 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends IgniteCacheTopolo
REPAIRED;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9f8f366a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
index 196681d..9d978e2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTopologySplitAbstractTest.java
@@ -27,8 +27,10 @@ import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.lang.IgniteBiPredicate;
@@ -44,7 +46,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
* Abstract class for tests over split in two half topology.
*/
public abstract class IgniteCacheTopologySplitAbstractTest extends GridCommonAbstractTest {
-
/** Segmentation state. */
private volatile boolean segmented;
@@ -64,6 +65,37 @@ public abstract class IgniteCacheTopologySplitAbstractTest extends GridCommonAbs
}
/**
+ * @param seg Cluster segment.
+ * @param topVer Topology version to wait for.
+ */
+ protected void awaitExchangeVersionFinished(Collection<Ignite> seg, long topVer) {
+ AffinityTopologyVersion waitTopVer = new AffinityTopologyVersion(topVer, 0);
+
+ for (Ignite grid : seg) {
+ IgniteInternalFuture<?> exchFut =
+ ((IgniteEx)grid).context().cache().context().exchange().affinityReadyFuture(waitTopVer);
+
+ if (exchFut != null && !exchFut.isDone()) {
+ try {
+ if (log.isDebugEnabled())
+ log.debug("Waiting for topology exchange future [grid=" + grid.name() + ", ver="
+ + topVer + ", curTopVer=" + grid.cluster().topologyVersion() + "]" );
+
+ exchFut.get();
+ }
+ catch (IgniteCheckedException e) {
+ log.error("Failed to wait for exchange [topVer=" + waitTopVer +
+ ", node=" + grid.name() + ']', e);
+ }
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Finished topology exchange future [grid=" + grid.name() + ", curTopVer="
+ + grid.cluster().topologyVersion() + "]" );
+ }
+ }
+
+ /**
* Trigger segmentation and wait for results. Should be called on stable topology.
*
* @throws InterruptedException If interrupted while waiting.
@@ -97,15 +129,8 @@ public abstract class IgniteCacheTopologySplitAbstractTest extends GridCommonAbs
}
});
- for (Ignite grid : seg0)
- ((IgniteKernal)grid).context().discovery().topologyFuture(topVer + seg1.size()).get();
-
- for (Ignite grid : seg1)
- ((IgniteKernal)grid).context().discovery().topologyFuture(topVer + seg0.size()).get();
-
- // awaitPartitionMapExchange won't work because coordinator is wrong for second segment.
- for (Ignite grid : G.allGrids())
- ((IgniteKernal)grid).context().cache().context().exchange().lastTopologyFuture().get();
+ awaitExchangeVersionFinished(seg0, topVer + seg1.size());
+ awaitExchangeVersionFinished(seg1, topVer + seg0.size());
if (log.isInfoEnabled())
log.info(">>> Finished waiting for split");
@@ -263,4 +288,4 @@ public abstract class IgniteCacheTopologySplitAbstractTest extends GridCommonAbs
return segment(locNode) != segment(node);
}
}
-}
\ No newline at end of file
+}