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/04/04 11:36:27 UTC
ignite git commit: IGNITE-8130 Fixed race in test
Repository: ignite
Updated Branches:
refs/heads/master ffe729633 -> 84489f107
IGNITE-8130 Fixed race in test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/84489f10
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/84489f10
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/84489f10
Branch: refs/heads/master
Commit: 84489f10797b31ffbb7dd84d57c7235da494e409
Parents: ffe7296
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Apr 4 14:36:10 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 4 14:36:10 2018 +0300
----------------------------------------------------------------------
.../thin/JdbcThinWalModeChangeSelfTest.java | 9 ++++-
.../WalModeChangeCommonAbstractSelfTest.java | 41 ++++++++++++++++----
2 files changed, 40 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/84489f10/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java
index 3aa88bc..addbf13 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinWalModeChangeSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.jdbc.thin;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteKernal;
@@ -41,7 +42,7 @@ public class JdbcThinWalModeChangeSelfTest extends WalModeChangeAbstractSelfTest
}
/** {@inheritDoc} */
- @Override protected void createCache(Ignite node, CacheConfiguration ccfg) {
+ @Override protected void createCache(Ignite node, CacheConfiguration ccfg) throws IgniteCheckedException {
String template = ccfg.getCacheMode() == CacheMode.PARTITIONED ?
QueryUtils.TEMPLATE_PARTITIONED : QueryUtils.TEMPLATE_REPLICATED;
@@ -54,13 +55,17 @@ public class JdbcThinWalModeChangeSelfTest extends WalModeChangeAbstractSelfTest
"\"";
execute(node, cmd);
+
+ alignCacheTopologyVersion(node);
}
/** {@inheritDoc} */
- @Override protected void destroyCache(Ignite node, String cacheName) {
+ @Override protected void destroyCache(Ignite node, String cacheName) throws IgniteCheckedException {
String cmd = "DROP TABLE IF EXISTS " + cacheName;
execute(node, cmd);
+
+ alignCacheTopologyVersion(node);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/84489f10/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java
index e2ae4fa..3056a13 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WalModeChangeCommonAbstractSelfTest.java
@@ -17,6 +17,10 @@
package org.apache.ignite.internal.processors.cache;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.Callable;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.Ignition;
@@ -28,20 +32,17 @@ import org.apache.ignite.configuration.DataRegionConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteClientReconnectAbstractTest;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.lang.IgniteInClosureX;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgnitePredicate;
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 java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.Callable;
-
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
/**
@@ -127,8 +128,10 @@ public abstract class WalModeChangeCommonAbstractSelfTest extends GridCommonAbst
* @param ccfg Cache configuration.
*/
@SuppressWarnings("unchecked")
- protected void createCache(Ignite node, CacheConfiguration ccfg) {
+ protected void createCache(Ignite node, CacheConfiguration ccfg) throws IgniteCheckedException {
node.getOrCreateCache(ccfg);
+
+ alignCacheTopologyVersion(node);
}
/**
@@ -137,8 +140,30 @@ public abstract class WalModeChangeCommonAbstractSelfTest extends GridCommonAbst
* @param node Node.
* @param cacheName Cache name.
*/
- protected void destroyCache(Ignite node, String cacheName) {
+ protected void destroyCache(Ignite node, String cacheName) throws IgniteCheckedException {
node.destroyCache(cacheName);
+
+ alignCacheTopologyVersion(node);
+ }
+
+ /**
+ * Waits for the topology version to be not less than one registered on source node.
+ *
+ * @param src Source node.
+ * @throws IgniteCheckedException If failed to wait on affinity ready future.
+ */
+ protected void alignCacheTopologyVersion(Ignite src) throws IgniteCheckedException {
+ AffinityTopologyVersion topVer = ((IgniteEx)src).context().cache().context().exchange().readyAffinityVersion();
+
+ info("Will wait for topology version on all nodes: " + topVer);
+
+ for (Ignite ignite : Ignition.allGrids()) {
+ IgniteInternalFuture<?> ready = ((IgniteEx)ignite).context().cache().context().exchange()
+ .affinityReadyFuture(topVer);
+
+ if (ready != null)
+ ready.get();
+ }
}
/**