You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/08/23 15:29:59 UTC

ignite git commit: ignite-6174 Temporary changed test until issue not fixed

Repository: ignite
Updated Branches:
  refs/heads/master eee638d3d -> 4fe8f762c


ignite-6174 Temporary changed test until issue not fixed


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

Branch: refs/heads/master
Commit: 4fe8f762c2dc1b62bdcddd606b66dc67215b50a6
Parents: eee638d
Author: sboikov <sb...@gridgain.com>
Authored: Wed Aug 23 18:29:52 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Aug 23 18:29:52 2017 +0300

----------------------------------------------------------------------
 ...ePrimaryNodeFailureRecoveryAbstractTest.java | 111 ++++++++++---------
 1 file changed, 60 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4fe8f762/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
index 0d0cda4..d147d31 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
@@ -56,6 +56,7 @@ import org.apache.ignite.transactions.Transaction;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.internal.processors.cache.ExchangeContext.IGNITE_EXCHANGE_COMPATIBILITY_VER_1;
 import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
 import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
 import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
@@ -328,91 +329,99 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
         boolean optimistic)
         throws Exception
     {
-        IgniteCache<Integer, Integer> cache0 = jcache(0);
-        IgniteCache<Integer, Integer> cache2 = jcache(2);
+        // TODO IGNITE-6174: when exchanges can be merged test fails because of IGNITE-6174.
+        System.setProperty(IGNITE_EXCHANGE_COMPATIBILITY_VER_1, "true");
 
-        Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
+        try {
+            IgniteCache<Integer, Integer> cache0 = jcache(0);
+            IgniteCache<Integer, Integer> cache2 = jcache(2);
 
-        Integer key0 = null;
+            Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
-        for (int key = 0; key < 10_000; key++) {
-            if (aff.isPrimary(ignite(1).cluster().localNode(), key)) {
-                if (locBackupKey == aff.isBackup(ignite(0).cluster().localNode(), key)) {
-                    key0 = key;
+            Integer key0 = null;
 
-                    break;
+            for (int key = 0; key < 10_000; key++) {
+                if (aff.isPrimary(ignite(1).cluster().localNode(), key)) {
+                    if (locBackupKey == aff.isBackup(ignite(0).cluster().localNode(), key)) {
+                        key0 = key;
+
+                        break;
+                    }
                 }
             }
-        }
 
-        assertNotNull(key0);
+            assertNotNull(key0);
 
-        final Integer key1 = key0;
-        final Integer key2 = primaryKey(cache2);
+            final Integer key1 = key0;
+            final Integer key2 = primaryKey(cache2);
 
-        int backups = cache0.getConfiguration(CacheConfiguration.class).getBackups();
+            int backups = cache0.getConfiguration(CacheConfiguration.class).getBackups();
 
-        final Collection<ClusterNode> key1Nodes =
-            (locBackupKey && backups < 2) ? null : aff.mapKeyToPrimaryAndBackups(key1);
-        final Collection<ClusterNode> key2Nodes = aff.mapKeyToPrimaryAndBackups(key2);
+            final Collection<ClusterNode> key1Nodes =
+                (locBackupKey && backups < 2) ? null : aff.mapKeyToPrimaryAndBackups(key1);
+            final Collection<ClusterNode> key2Nodes = aff.mapKeyToPrimaryAndBackups(key2);
 
-        TestCommunicationSpi commSpi = (TestCommunicationSpi)ignite(0).configuration().getCommunicationSpi();
+            TestCommunicationSpi commSpi = (TestCommunicationSpi)ignite(0).configuration().getCommunicationSpi();
 
-        IgniteTransactions txs = ignite(0).transactions();
+            IgniteTransactions txs = ignite(0).transactions();
 
-        Transaction tx = txs.txStart(optimistic ? OPTIMISTIC : PESSIMISTIC, REPEATABLE_READ);
+            Transaction tx = txs.txStart(optimistic ? OPTIMISTIC : PESSIMISTIC, REPEATABLE_READ);
 
-        log.info("Put key1 [key1=" + key1 + ", nodes=" + U.nodeIds(aff.mapKeyToPrimaryAndBackups(key1)) + ']');
+            log.info("Put key1 [key1=" + key1 + ", nodes=" + U.nodeIds(aff.mapKeyToPrimaryAndBackups(key1)) + ']');
 
-        cache0.put(key1, key1);
+            cache0.put(key1, key1);
 
-        log.info("Put key2 [key2=" + key2 + ", nodes=" + U.nodeIds(aff.mapKeyToPrimaryAndBackups(key2)) + ']');
+            log.info("Put key2 [key2=" + key2 + ", nodes=" + U.nodeIds(aff.mapKeyToPrimaryAndBackups(key2)) + ']');
 
-        cache0.put(key2, key2);
+            cache0.put(key2, key2);
 
-        log.info("Start prepare.");
+            log.info("Start prepare.");
 
-        GridNearTxLocal txEx = ((TransactionProxyImpl)tx).tx();
+            GridNearTxLocal txEx = ((TransactionProxyImpl)tx).tx();
 
-        commSpi.blockMessages(ignite(2).cluster().localNode().id()); // Do not allow to finish prepare for key2.
+            commSpi.blockMessages(ignite(2).cluster().localNode().id()); // Do not allow to finish prepare for key2.
 
-        IgniteInternalFuture<?> prepFut = txEx.prepareNearTxLocal();
+            IgniteInternalFuture<?> prepFut = txEx.prepareNearTxLocal();
 
-        waitPrepared(ignite(1));
+            waitPrepared(ignite(1));
 
-        log.info("Stop one primary node.");
+            log.info("Stop one primary node.");
 
-        stopGrid(1);
+            stopGrid(1);
 
-        U.sleep(1000); // Wait some time to catch possible issues in tx recovery.
+            U.sleep(1000); // Wait some time to catch possible issues in tx recovery.
 
-        if (!rollback) {
-            commSpi.stopBlock();
+            if (!rollback) {
+                commSpi.stopBlock();
 
-            prepFut.get(10_000);
-        }
+                prepFut.get(10_000);
+            }
 
-        log.info("Stop originating node.");
+            log.info("Stop originating node.");
 
-        stopGrid(0);
+            stopGrid(0);
 
-        GridTestUtils.waitForCondition(new GridAbsPredicate() {
-            @Override public boolean apply() {
-                try {
-                    checkKey(key1, rollback ? null : key1Nodes);
-                    checkKey(key2, rollback ? null : key2Nodes);
+            GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    try {
+                        checkKey(key1, rollback ? null : key1Nodes);
+                        checkKey(key2, rollback ? null : key2Nodes);
 
-                    return true;
-                } catch (AssertionError e) {
-                    log.info("Check failed: " + e);
+                        return true;
+                    } catch (AssertionError e) {
+                        log.info("Check failed: " + e);
 
-                    return false;
+                        return false;
+                    }
                 }
-            }
-        }, 5000);
+            }, 5000);
 
-        checkKey(key1, rollback ? null : key1Nodes);
-        checkKey(key2, rollback ? null : key2Nodes);
+            checkKey(key1, rollback ? null : key1Nodes);
+            checkKey(key2, rollback ? null : key2Nodes);
+        }
+        finally {
+            System.clearProperty(IGNITE_EXCHANGE_COMPATIBILITY_VER_1);
+        }
     }
 
     /**