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 2015/04/10 03:02:03 UTC

[23/23] incubator-ignite git commit: IGNITE-80 - Fixing cross-cache transactions issues.

IGNITE-80 - Fixing cross-cache transactions issues.


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

Branch: refs/heads/ignite-80
Commit: efbdc831dcd21f9da1d5d35b7b0e8bca02ddf068
Parents: 3f277c2
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Thu Apr 9 18:01:31 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Thu Apr 9 18:01:31 2015 -0700

----------------------------------------------------------------------
 .../cache/distributed/dht/GridDhtTxLocal.java   |  11 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   4 +-
 .../cache/distributed/dht/GridDhtTxMapping.java |  28 ++-
 .../distributed/dht/GridDhtTxPrepareFuture.java |  11 +-
 .../cache/distributed/near/GridNearTxLocal.java |  38 ++--
 .../near/GridNearTxPrepareFuture.java           |  16 +-
 .../distributed/IgniteCrossCacheTxSelfTest.java | 181 +++++++++++++++++++
 .../ignite/testsuites/IgniteCacheTestSuite.java |   1 +
 8 files changed, 241 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 00e8e3e..04418ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -406,7 +406,8 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
         }
         else {
             assert fut.nearMiniId().equals(nearMiniId) : "Wrong near mini id on existing future " +
-                "[futMiniId=" + fut.nearMiniId() + ", miniId=" + nearMiniId + ", fut=" + fut + ']';
+                "[futMiniId=" + fut.nearMiniId() + ", miniId=" + nearMiniId + ", fut=" + fut +
+                ", tx=" + this + ']';
 
             // Prepare was called explicitly.
             return fut;
@@ -482,10 +483,6 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
         if (log.isDebugEnabled())
             log.debug("Committing dht local tx: " + this);
 
-        // In optimistic mode prepare was called explicitly.
-        if (pessimistic())
-            prepareAsync();
-
         final GridDhtTxFinishFuture fut = new GridDhtTxFinishFuture<>(cctx, this, /*commit*/true);
 
         cctx.mvcc().addFuture(fut);
@@ -541,8 +538,6 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
                 });
         }
         else {
-            assert optimistic();
-
             try {
                 if (finish(true))
                     fut.finish();
@@ -567,8 +562,6 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
 
     /** {@inheritDoc} */
     @Override protected void clearPrepareFuture(GridDhtTxPrepareFuture fut) {
-        assert optimistic();
-
         prepFut.compareAndSet(fut, null);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 54ceb36..02b412c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -51,11 +51,11 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
     private static final long serialVersionUID = 0L;
 
     /** Near mappings. */
-    protected Map<UUID, GridDistributedTxMapping> nearMap =
+    protected final Map<UUID, GridDistributedTxMapping> nearMap =
         new ConcurrentHashMap8<>();
 
     /** DHT mappings. */
-    protected Map<UUID, GridDistributedTxMapping> dhtMap =
+    protected final Map<UUID, GridDistributedTxMapping> dhtMap =
         new ConcurrentHashMap8<>();
 
     /** Mapped flag. */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
index d207d76..4df1b9e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxMapping.java
@@ -29,6 +29,9 @@ import java.util.*;
  * DHT transaction mapping.
  */
 public class GridDhtTxMapping<K, V> {
+    /** */
+    private UUID locNodeId;
+
     /** Transaction nodes mapping (primary node -> related backup nodes). */
     private final Map<UUID, Collection<UUID>> txNodes = new GridLeanMap<>();
 
@@ -39,18 +42,25 @@ public class GridDhtTxMapping<K, V> {
     private TxMapping last;
 
     /**
+     * @param locNodeId Local node ID.
+     */
+    public GridDhtTxMapping(UUID locNodeId) {
+        this.locNodeId = locNodeId;
+    }
+
+    /**
      * Adds information about next mapping.
      *
      * @param nodes Nodes.
      */
     @SuppressWarnings("ConstantConditions")
-    public void addMapping(List<ClusterNode> nodes) {
+    public void addMapping(List<ClusterNode> nodes, boolean near) {
         ClusterNode primary = F.first(nodes);
 
         Collection<ClusterNode> backups = F.view(nodes, F.notEqualTo(primary));
 
-        if (last == null || !last.primary.equals(primary.id())) {
-            last = new TxMapping(primary, backups);
+        if (last == null || !last.primary.equals(primary.id()) || last.near != near) {
+            last = new TxMapping(primary, backups, near);
 
             mappings.add(last);
         }
@@ -78,7 +88,8 @@ public class GridDhtTxMapping<K, V> {
      * @param mappings Mappings.
      */
     public void initLast(Collection<GridDistributedTxMapping> mappings) {
-        assert this.mappings.size() == mappings.size();
+        assert this.mappings.size() == mappings.size() :
+            "this.size=" + this.mappings.size() + ", size=" + mappings.size();
 
         int idx = 0;
 
@@ -92,7 +103,7 @@ public class GridDhtTxMapping<K, V> {
             for (int i = idx + 1; i < this.mappings.size(); i++) {
                 TxMapping nextMap = this.mappings.get(i);
 
-                if (nextMap.primary.equals(mapping.primary)) {
+                if (nextMap.primary.equals(mapping.primary) && (!F.eq(locNodeId, nextMap.primary) || nextMap.near == mapping.near)) {
                     last = false;
 
                     break;
@@ -146,15 +157,20 @@ public class GridDhtTxMapping<K, V> {
         /** */
         private final Set<UUID> backups;
 
+        /** */
+        private final boolean near;
+
         /**
          * @param primary Primary node.
          * @param backups Backup nodes.
          */
-        private TxMapping(ClusterNode primary, Iterable<ClusterNode> backups) {
+        private TxMapping(ClusterNode primary, Iterable<ClusterNode> backups, boolean near) {
             this.primary = primary.id();
 
             this.backups = new HashSet<>();
 
+            this.near = near;
+
             add(backups);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 1f991c1..7cbfbe2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -482,8 +482,12 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
         this.err.compareAndSet(null, err);
 
         // Must clear prepare future before response is sent or listeners are notified.
-        if (tx.optimistic())
-            tx.clearPrepareFuture(this);
+        tx.clearPrepareFuture(this);
+
+        if (last || tx.isSystemInvalidate()) {
+            if (!tx.near())
+                tx.state(PREPARED);
+        }
 
         if (tx.onePhaseCommit()) {
             assert last;
@@ -681,9 +685,6 @@ public final class GridDhtTxPrepareFuture<K, V> extends GridCompoundIdentityFutu
      * @return {@code True} if {@code done} flag was changed as a result of this call.
      */
     private boolean onComplete() {
-        if (last || tx.isSystemInvalidate())
-            tx.state(PREPARED);
-
         if (super.onDone(tx, err.get())) {
             // Don't forget to clean up.
             cctx.mvcc().removeFuture(this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index fa916b0..a82a628 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -561,31 +561,31 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
             F.concat(false, mapping.reads(), mapping.writes());
 
         for (IgniteTxEntry txEntry : entries) {
-            while (true) {
-                GridCacheContext cacheCtx = txEntry.cached().context();
+            GridCacheContext cacheCtx = txEntry.cached().context();
 
-                assert cacheCtx.isNear();
+            if (cacheCtx.isNear()) {
+                while (true) {
+                    GridDistributedCacheEntry entry = (GridDistributedCacheEntry)txEntry.cached();
 
-                GridDistributedCacheEntry entry = (GridDistributedCacheEntry)txEntry.cached();
-
-                try {
-                    // Handle explicit locks.
-                    GridCacheVersion explicit = txEntry.explicitVersion();
+                    try {
+                        // Handle explicit locks.
+                        GridCacheVersion explicit = txEntry.explicitVersion();
 
-                    if (explicit == null)
-                        entry.readyNearLock(xidVer, mapping.dhtVersion(), committedVers, rolledbackVers, pendingVers);
+                        if (explicit == null)
+                            entry.readyNearLock(xidVer, mapping.dhtVersion(), committedVers, rolledbackVers, pendingVers);
 
-                    break;
-                }
-                catch (GridCacheEntryRemovedException ignored) {
-                    assert entry.obsoleteVersion() != null;
+                        break;
+                    }
+                    catch (GridCacheEntryRemovedException ignored) {
+                        assert entry.obsoleteVersion() != null;
 
-                    if (log.isDebugEnabled())
-                        log.debug("Replacing obsolete entry in remote transaction [entry=" + entry +
-                            ", tx=" + this + ']');
+                        if (log.isDebugEnabled())
+                            log.debug("Replacing obsolete entry in remote transaction [entry=" + entry +
+                                ", tx=" + this + ']');
 
-                    // Replace the entry.
-                    txEntry.cached(txEntry.context().cache().entryEx(txEntry.key()));
+                        // Replace the entry.
+                        txEntry.cached(txEntry.context().cache().entryEx(txEntry.key()));
+                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
index 2da78fb..1481f40 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFuture.java
@@ -217,7 +217,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
      * @return {@code True} if all locks are owned.
      */
     private boolean checkLocks() {
-        boolean locked = lockKeys.isEmpty();
+        boolean locked = lockKeys.isEmpty() && pending().isEmpty();
 
         if (locked) {
             if (log.isDebugEnabled())
@@ -457,7 +457,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
         assert topVer.topologyVersion() > 0;
 
-        txMapping = new GridDhtTxMapping<>();
+        txMapping = new GridDhtTxMapping<>(cctx.localNodeId());
 
         ConcurrentLinkedDeque8<GridDistributedTxMapping> mappings =
             new ConcurrentLinkedDeque8<>();
@@ -540,7 +540,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
         AffinityTopologyVersion topVer = tx.topologyVersion();
 
-        txMapping = new GridDhtTxMapping<>();
+        txMapping = new GridDhtTxMapping<>(cctx.localNodeId());
 
         for (IgniteTxEntry txEntry : tx.allEntries()) {
             GridCacheContext cacheCtx = txEntry.context();
@@ -549,7 +549,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
             ClusterNode primary = F.first(nodes);
 
-            boolean near = cacheCtx.isNear();
+            boolean near = primary.isLocal() && cacheCtx.isNear();
 
             IgniteBiTuple<ClusterNode, Boolean> key = F.t(primary, near);
 
@@ -567,7 +567,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
             nodeMapping.add(txEntry);
 
-            txMapping.addMapping(nodes);
+            txMapping.addMapping(nodes, near);
         }
 
         tx.transactionNodes(txMapping.transactionNodes());
@@ -750,10 +750,10 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
         List<ClusterNode> nodes = cacheCtx.affinity().nodes(entry.key(), topVer);
 
-        txMapping.addMapping(nodes);
-
         ClusterNode primary = F.first(nodes);
 
+        txMapping.addMapping(nodes, cacheCtx.isNear());
+
         assert primary != null;
 
         if (log.isDebugEnabled()) {
@@ -812,7 +812,7 @@ public final class GridNearTxPrepareFuture<K, V> extends GridCompoundIdentityFut
 
     /** {@inheritDoc} */
     @Override public String toString() {
-        return S.toString(GridNearTxPrepareFuture.class, this, super.toString());
+        return S.toString(GridNearTxPrepareFuture.class, this, "pending", pending(), "super", super.toString());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxSelfTest.java
new file mode 100644
index 0000000..3be55ac
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCrossCacheTxSelfTest.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache.distributed;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
+import org.jsr166.*;
+
+import java.util.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
+
+/**
+ * Tests specific combinations of cross-cache transactions.
+ */
+public class IgniteCrossCacheTxSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final String FIRST_CACHE = "FirstCache";
+
+    /** */
+    private static final String SECOND_CACHE = "SecondCache";
+
+    /** */
+    private static final int TX_CNT = 500;
+
+    /**
+     * @return Node count for this test.
+     */
+    protected int nodeCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(nodeCount());
+
+        CacheConfiguration firstCfg = new CacheConfiguration(FIRST_CACHE);
+        firstCfg.setBackups(1);
+        firstCfg.setAtomicityMode(TRANSACTIONAL);
+        firstCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+
+        grid(0).createCache(firstCfg);
+
+        CacheConfiguration secondCfg = new CacheConfiguration(SECOND_CACHE);
+        secondCfg.setBackups(1);
+        secondCfg.setAtomicityMode(TRANSACTIONAL);
+        secondCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+        secondCfg.setNearConfiguration(new NearCacheConfiguration());
+
+        grid(0).createCache(secondCfg);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPessimisticReadCommitted() throws Exception {
+        checkTxsSingleOp(PESSIMISTIC, READ_COMMITTED);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPessimisticRepeatableRead() throws Exception {
+        checkTxsSingleOp(PESSIMISTIC, REPEATABLE_READ);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOptimisticReadCommitted() throws Exception {
+        checkTxsSingleOp(OPTIMISTIC, READ_COMMITTED);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOptimisticRepeatableRead() throws Exception {
+        checkTxsSingleOp(OPTIMISTIC, REPEATABLE_READ);
+    }
+
+    /**
+     * @param concurrency Concurrency.
+     * @param isolation Isolation.
+     * @throws Exception If failed.
+     */
+    private void checkTxsSingleOp(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception {
+        Map<Integer, String> firstCheck = new HashMap<>();
+        Map<Integer, String> secondCheck = new HashMap<>();
+
+        for (int i = 0; i < TX_CNT; i++) {
+            int grid = ThreadLocalRandom8.current().nextInt(nodeCount());
+
+            try (Transaction tx = grid(grid).transactions().txStart(concurrency, isolation)) {
+                try {
+                    IgniteCache<Integer, String> first = grid(grid).cache(FIRST_CACHE);
+                    IgniteCache<Integer, String> second = grid(grid).cache(SECOND_CACHE);
+
+                    int size = ThreadLocalRandom8.current().nextInt(24) + 1;
+
+                    for (int k = 0; k < size; k++) {
+                        boolean rnd = ThreadLocalRandom8.current().nextBoolean();
+
+                        IgniteCache<Integer, String> cache = rnd ? first : second;
+                        Map<Integer, String> check = rnd ? firstCheck : secondCheck;
+
+                        String val = rnd ? "first" + i : "second" + i;
+
+                        cache.put(k, val);
+                        check.put(k, val);
+                    }
+
+                    tx.commit();
+                }
+                catch (Throwable e) {
+                    e.printStackTrace();
+
+                    throw e;
+                }
+            }
+
+            if (i > 0 && i % 100 == 0)
+                info("Finished iteration: " + i);
+        }
+
+        for (int g = 0; g < nodeCount(); g++) {
+            IgniteEx grid = grid(g);
+
+            assertEquals(0, grid.context().cache().context().tm().idMapSize());
+
+            ClusterNode locNode = grid.localNode();
+
+            IgniteCache<Object, Object> firstCache = grid.cache(FIRST_CACHE);
+
+            for (Map.Entry<Integer, String> entry : firstCheck.entrySet()) {
+                boolean primary = grid.affinity(FIRST_CACHE).isPrimary(locNode, entry.getKey());
+
+                boolean backup = grid.affinity(FIRST_CACHE).isBackup(locNode, entry.getKey());
+
+                assertEquals("Invalid value found first cache [primary=" + primary + ", backup=" + backup +
+                        ", node=" + locNode.id() + ", key=" + entry.getKey() + ']',
+                    entry.getValue(), firstCache.get(entry.getKey()));
+            }
+
+            for (Map.Entry<Integer, String> entry : secondCheck.entrySet()) {
+                boolean primary = grid.affinity(SECOND_CACHE).isPrimary(locNode, entry.getKey());
+
+                boolean backup = grid.affinity(SECOND_CACHE).isBackup(locNode, entry.getKey());
+
+                assertEquals("Invalid value found second cache [primary=" + primary + ", backup=" + backup +
+                    ", node=" + locNode.id() + ", key=" + entry.getKey() + ']',
+                    entry.getValue(), grid.cache(SECOND_CACHE).get(entry.getKey()));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/efbdc831/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 8c6ca5d..7368cc6 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -66,6 +66,7 @@ public class IgniteCacheTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheTxNearEnabledInvokeTest.class);
         suite.addTestSuite(IgniteCacheTxLocalInvokeTest.class);
         suite.addTestSuite(IgniteCrossCacheTxStoreSelfTest.class);
+        suite.addTestSuite(IgniteCrossCacheTxSelfTest.class);
 
         suite.addTestSuite(IgnitePutAllLargeBatchSelfTest.class);
         suite.addTestSuite(IgnitePutAllUpdateNonPreloadedPartitionSelfTest.class);