ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-1607 WIP
Date Mon, 12 Oct 2015 14:13:36 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1607-read dab9f23c7 -> 0dde0ac25


ignite-1607 WIP


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

Branch: refs/heads/ignite-1607-read
Commit: 0dde0ac254456bbcd5b10365240bca95df053fd3
Parents: dab9f23
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Oct 12 15:16:11 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Oct 12 17:12:53 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheEntryEx.java      |   3 +-
 .../processors/cache/GridCacheMapEntry.java     |   2 +-
 .../distributed/GridDistributedCacheEntry.java  |   3 +-
 .../distributed/dht/GridDhtCacheEntry.java      |   9 +-
 .../distributed/dht/GridDhtLockFuture.java      |   3 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |   4 +-
 .../dht/colocated/GridDhtColocatedCache.java    |   5 +-
 .../near/GridNearTxFinishFuture.java            |  13 +--
 .../cache/transactions/IgniteTxManager.java     |   5 +
 .../CacheSerializableTransactionsTest.java      | 116 ++++++++++++++++---
 .../GridCacheAbstractRemoveFailureTest.java     |  94 +++++++++++++--
 .../IgniteCacheCrossCacheTxFailoverTest.java    |   8 ++
 .../near/GridCacheNearTxExceptionSelfTest.java  |   1 +
 .../inmemory/GridTestSwapSpaceSpi.java          |   8 ++
 14 files changed, 232 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 9106b05..c642b55 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -541,9 +541,10 @@ public interface GridCacheEntryEx {
      * @return {@code True} if lock was acquired, {@code false} otherwise.
      * @throws GridCacheEntryRemovedException If this entry is obsolete.
      * @throws GridDistributedLockCancelledException If lock has been cancelled.
+     * @throws IgniteCheckedException If failed.
      */
     public boolean tmLock(IgniteInternalTx tx, long timeout, @Nullable GridCacheVersion serReadVer)
-        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException;
+        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException, IgniteCheckedException;
 
     /**
      * Unlocks acquired lock.

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index fd0fb92..c734629 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -875,7 +875,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
                 updateTtl(expiryPlc);
 
             if (retVer) {
-                resVer = isNear() ? ((GridNearCacheEntry)this).dhtVersion() : startVer;
+                resVer = isNear() ? ((GridNearCacheEntry)this).dhtVersion() : this.ver;
 
                 if (resVer == null)
                     ret = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
index bed3275..0bfbe7d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
@@ -22,6 +22,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -743,7 +744,7 @@ public class GridDistributedCacheEntry extends GridCacheMapEntry {
 
     /** {@inheritDoc} */
     @Override public boolean tmLock(IgniteInternalTx tx, long timeout, GridCacheVersion serReadVer)
-        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException {
+        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException, IgniteCheckedException
{
         if (tx.local())
             // Null is returned if timeout is negative and there is other lock owner.
             return addLocal(

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
index 0004f02..9c10a0a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
@@ -172,6 +172,7 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
      * @return New candidate.
      * @throws GridCacheEntryRemovedException If entry has been removed.
      * @throws GridDistributedLockCancelledException If lock was cancelled.
+     * @throws IgniteCheckedException If failed.
      */
     @Nullable public GridCacheMvccCandidate addDhtLocal(
         UUID nearNodeId,
@@ -183,7 +184,9 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
         long timeout,
         boolean reenter,
         boolean tx,
-        boolean implicitSingle) throws GridCacheEntryRemovedException, GridDistributedLockCancelledException
{
+        boolean implicitSingle)
+        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException, IgniteCheckedException
+    {
         GridCacheMvccCandidate cand;
         GridCacheMvccCandidate prev;
         GridCacheMvccCandidate owner;
@@ -198,6 +201,8 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
             checkObsolete();
 
             if (serReadVer != null) {
+                unswap(false);
+
                 if (!serReadVer.equals(this.ver)) {
                     if (!((isNew() || deleted()) && serReadVer.equals(IgniteTxEntry.READ_NEW_ENTRY_VER)))
                         return null;
@@ -261,7 +266,7 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
 
     /** {@inheritDoc} */
     @Override public boolean tmLock(IgniteInternalTx tx, long timeout, GridCacheVersion serReadVer)
-        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException {
+        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException, IgniteCheckedException
{
         if (tx.local()) {
             GridDhtTxLocalAdapter dhtTx = (GridDhtTxLocalAdapter)tx;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index f9adfe8..c64d909 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -380,9 +380,10 @@ public final class GridDhtLockFuture extends GridCompoundIdentityFuture<Boolean>
      * @return Lock candidate.
      * @throws GridCacheEntryRemovedException If entry was removed.
      * @throws GridDistributedLockCancelledException If lock is canceled.
+     * @throws IgniteCheckedException If failed.
      */
     @Nullable public GridCacheMvccCandidate addEntry(GridDhtCacheEntry entry)
-        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException {
+        throws GridCacheEntryRemovedException, GridDistributedLockCancelledException, IgniteCheckedException
{
         if (log.isDebugEnabled())
             log.debug("Adding entry: " + entry);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 1a869e7..501cf27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -671,9 +671,9 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends
GridDhtCach
                         if (log.isDebugEnabled())
                             log.debug("Got removed entry when adding lock (will retry): "
+ entry);
                     }
-                    catch (GridDistributedLockCancelledException e) {
+                    catch (IgniteCheckedException | GridDistributedLockCancelledException
e) {
                         if (log.isDebugEnabled())
-                            log.debug("Got lock request for cancelled lock (will fail): "
+ entry);
+                            log.debug("Failed to add entry [err=" + e + ", entry=" + entry
+ ']');
 
                         return new GridDhtFinishedFuture<>(e);
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 6b6352f..fd43053 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -888,10 +888,9 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
                         if (log.isDebugEnabled())
                             log.debug("Got removed entry when adding lock (will retry): "
+ entry);
                     }
-                    catch (GridDistributedLockCancelledException e) {
+                    catch (IgniteCheckedException | GridDistributedLockCancelledException
e) {
                         if (log.isDebugEnabled())
-                            log.debug("Got lock request for cancelled lock (will ignore):
" +
-                                entry);
+                            log.debug("Failed to add entry [err=" + e + ", entry=" + entry
+ ']');
 
                         fut.onError(e);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index 2c1a79f..6378afd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -266,18 +266,11 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
             }
 
             if (tx.onePhaseCommit()) {
-                try {
-                    boolean commit = this.commit && err == null;
-
-                    tx.finish(commit);
+                boolean commit = this.commit && err == null;
 
-                    finishOnePhase(commit);
+                finishOnePhase(commit);
 
-                    tx.tmFinish(commit);
-                }
-                catch (IgniteCheckedException e) {
-                    U.error(log, "Failed to finish transaction: " + tx, e);
-                }
+                tx.tmFinish(commit);
             }
 
             Throwable th = this.err.get();

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 8cf7fce..21053a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -1442,6 +1442,11 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter
{
                         break;
                     }
                 }
+                catch (IgniteCheckedException e) {
+                    tx.setRollbackOnly();
+
+                    throw e;
+                }
                 catch (GridDistributedLockCancelledException ignore) {
                     tx.setRollbackOnly();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
index 1302698..377e9a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
@@ -47,12 +47,14 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
@@ -66,6 +68,8 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheMode.REPLICATED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.testframework.GridTestUtils.TestMemoryMode;
+import static org.apache.ignite.testframework.GridTestUtils.runMultiThreadedAsync;
 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;
@@ -103,6 +107,8 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
 
         cfg.setClientMode(client);
 
+        cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
+
         return cfg;
     }
 
@@ -370,6 +376,20 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
                     }
 
                     checkValue(key, expVal, cache0.getName());
+
+                    cache0.remove(key);
+
+                    try (Transaction tx = txs0.txStart(OPTIMISTIC, SERIALIZABLE)) {
+                        Integer val = cache0.get(key);
+
+                        assertNull(val);
+
+                        cache0.put(key, expVal + 1);
+
+                        tx.commit();
+                    }
+
+                    checkValue(key, expVal + 1, cache0.getName());
                 }
             }
             finally {
@@ -1230,36 +1250,51 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
      * @throws Exception If failed.
      */
     public void testTxNoConflictPut1() throws Exception {
-        txNoConflictUpdate(true, false);
+        txNoConflictUpdate(true, false, false);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testTxNoConflictPut2() throws Exception {
-        txNoConflictUpdate(false, false);
+        txNoConflictUpdate(false, false, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxNoConflictPut3() throws Exception {
+        txNoConflictUpdate(false, false, true);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testTxNoConflictRemove1() throws Exception {
-        txNoConflictUpdate(true, true);
+        txNoConflictUpdate(true, true, false);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testTxNoConflictRemove2() throws Exception {
-        txNoConflictUpdate(false, true);
+        txNoConflictUpdate(false, true, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTxNoConflictRemove3() throws Exception {
+        txNoConflictUpdate(false, true, true);
     }
 
     /**
      * @throws Exception If failed.
      * @param noVal If {@code true} there is no cache value when do update in tx.
      * @param rmv If {@code true} tests remove, otherwise put.
+     * @param getAfterUpdate If {@code true} tries to get value in tx after update.
      */
-    private void txNoConflictUpdate(boolean noVal, boolean rmv) throws Exception {
+    private void txNoConflictUpdate(boolean noVal, boolean rmv, boolean getAfterUpdate) throws
Exception {
         Ignite ignite0 = ignite(0);
 
         final IgniteTransactions txs = ignite0.transactions();
@@ -1284,6 +1319,15 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
                         else
                             cache.put(key, 2);
 
+                        if (getAfterUpdate) {
+                            Object val = cache.get(key);
+
+                            if (rmv)
+                                assertNull(val);
+                            else
+                                assertEquals(2, val);
+                        }
+
                         updateKey(cache, key, 1);
 
                         tx.commit();
@@ -1311,6 +1355,19 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
                     else
                         cache.putAll(map);
 
+                    if (getAfterUpdate) {
+                        Map<Integer, Integer> res = cache.getAll(map.keySet());
+
+                        if (rmv) {
+                            for (Integer key : map.keySet())
+                                assertNull(res.get(key));
+                        }
+                        else {
+                            for (Integer key : map.keySet())
+                                assertEquals(map.get(key), res.get(key));
+                        }
+                    }
+
                     txAsync(cache, PESSIMISTIC, REPEATABLE_READ,
                         new IgniteClosure<IgniteCache<Integer, Integer>, Void>()
{
                             @Override public Void apply(IgniteCache<Integer, Integer>
cache) {
@@ -1688,33 +1745,46 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
      * @throws Exception If failed.
      */
     public void testAccountTx1() throws Exception {
-        accountTx(false, false);
+        accountTx(false, false, TestMemoryMode.HEAP);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testAccountTxNearCache() throws Exception {
-        accountTx(false, true);
+        accountTx(false, true, TestMemoryMode.HEAP);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testAccountTx2() throws Exception {
-        accountTx(true, false);
+        accountTx(true, false, TestMemoryMode.HEAP);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAccountTxOffheapTiered() throws Exception {
+        accountTx(false, false, TestMemoryMode.OFFHEAP_TIERED);
     }
 
     /**
      * @param getAll If {@code true} uses getAll/putAll in transaction.
      * @param nearCache If {@code true} near cache is enabled.
+     * @param memMode Test memory mode.
      * @throws Exception If failed.
      */
-    private void accountTx(final boolean getAll, final boolean nearCache) throws Exception
{
+    private void accountTx(final boolean getAll,
+        final boolean nearCache,
+        TestMemoryMode memMode) throws Exception {
         final Ignite ignite0 = ignite(0);
 
-        final String cacheName =
-            ignite0.createCache(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, false, false)).getName();
+        CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(PARTITIONED,
FULL_SYNC, 1, false, false);
+
+        GridTestUtils.setMemoryMode(null, ccfg, memMode, 1, 64);
+
+        final String cacheName = ignite0.createCache(ccfg).getName();
 
         try {
             final List<Ignite> clients = clients();
@@ -1733,7 +1803,7 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
 
             final long stopTime = System.currentTimeMillis() + 10_000;
 
-            IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>()
{
+            IgniteInternalFuture<?> fut = runMultiThreadedAsync(new Callable<Void>()
{
                 @Override public Void call() throws Exception {
                     int nodeIdx = idx.getAndIncrement() % clients.size();
 
@@ -2089,6 +2159,15 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
         ccfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 1, true, true));
         ccfgs.add(cacheConfiguration(PARTITIONED, FULL_SYNC, 2, true, true));
 
+        // Swap and offheap enabled.
+        for (GridTestUtils.TestMemoryMode memMode : GridTestUtils.TestMemoryMode.values())
{
+            CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(PARTITIONED,
FULL_SYNC, 1, false, false);
+
+            GridTestUtils.setMemoryMode(null, ccfg, memMode, 1, 64);
+
+            ccfgs.add(ccfg);
+        }
+
         return ccfgs;
     }
 
@@ -2099,8 +2178,13 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
         log.info("Test cache [mode=" + ccfg.getCacheMode() +
             ", sync=" + ccfg.getWriteSynchronizationMode() +
             ", backups=" + ccfg.getBackups() +
+            ", memMode=" + ccfg.getMemoryMode() +
             ", near=" + (ccfg.getNearConfiguration() != null) +
-            ", store=" + ccfg.isWriteThrough() + ']');
+            ", store=" + ccfg.isWriteThrough() +
+            ", evictPlc=" + (ccfg.getEvictionPolicy() != null) +
+            ", swap=" + ccfg.isSwapEnabled()  +
+            ", maxOffheap=" + ccfg.getOffHeapMaxMemory()  +
+            ']');
     }
 
     /**
@@ -2233,6 +2317,12 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest
{
         storeMap.clear();
 
         ignite.destroyCache(cacheName);
+
+        for (Ignite ignite0 : G.allGrids()) {
+            GridTestSwapSpaceSpi spi = (GridTestSwapSpaceSpi)ignite0.configuration().getSwapSpaceSpi();
+
+            spi.clearAll();
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
index 122910e..5044516 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
@@ -30,6 +30,8 @@ import java.util.concurrent.atomic.AtomicReference;
 import javax.cache.CacheException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteTransactions;
 import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
@@ -37,9 +39,11 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.util.lang.GridTuple;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -48,11 +52,18 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
 import org.jsr166.ConcurrentHashMap8;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+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;
+import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
 
 /**
  * Tests that removes are not lost when topology changes.
@@ -155,29 +166,54 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
      * @throws Exception If failed.
      */
     public void testPutAndRemove() throws Exception {
-        putAndRemove(DUR, GridTestUtils.TestMemoryMode.HEAP);
+        putAndRemove(DUR, null, null, GridTestUtils.TestMemoryMode.HEAP);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutAndRemovePessimisticTx() throws Exception {
+        if (atomicityMode() != CacheAtomicityMode.TRANSACTIONAL)
+            return;
+
+        putAndRemove(30_000, PESSIMISTIC, REPEATABLE_READ, GridTestUtils.TestMemoryMode.HEAP);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutAndRemoveOptimisticSerializableTx() throws Exception {
+        if (atomicityMode() != CacheAtomicityMode.TRANSACTIONAL)
+            return;
+
+        putAndRemove(30_000, OPTIMISTIC, SERIALIZABLE, GridTestUtils.TestMemoryMode.HEAP);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPutAndRemoveOffheapEvict() throws Exception {
-        putAndRemove(30_000, GridTestUtils.TestMemoryMode.OFFHEAP_EVICT);
+        putAndRemove(30_000, null, null, GridTestUtils.TestMemoryMode.OFFHEAP_EVICT);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPutAndRemoveOffheapEvictSwap() throws Exception {
-        putAndRemove(30_000, GridTestUtils.TestMemoryMode.OFFHEAP_EVICT_SWAP);
+        putAndRemove(30_000, null, null, GridTestUtils.TestMemoryMode.OFFHEAP_EVICT_SWAP);
     }
 
     /**
      * @param duration Test duration.
+     * @param txConcurrency Transaction concurrency if test explicit transaction.
+     * @param txIsolation Transaction isolation if test explicit transaction.
      * @param memMode Memory mode.
      * @throws Exception If failed.
      */
-    private void putAndRemove(long duration, GridTestUtils.TestMemoryMode memMode) throws
Exception {
+    private void putAndRemove(long duration,
+        final TransactionConcurrency txConcurrency,
+        final TransactionIsolation txIsolation,
+        GridTestUtils.TestMemoryMode memMode) throws Exception {
         assertEquals(testClientNode(), (boolean) grid(0).configuration().isClientMode());
 
         grid(0).destroyCache(null);
@@ -216,6 +252,8 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
 
                 ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
+                IgniteTransactions txs = sndCache0.unwrap(Ignite.class).transactions();
+
                 while (!stop.get()) {
                     for (int i = 0; i < 100; i++) {
                         int key = rnd.nextInt(KEYS_CNT);
@@ -225,14 +263,54 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
                         while (true) {
                             try {
                                 if (put) {
-                                    sndCache0.put(key, i);
+                                    boolean failed = false;
+
+                                    if (txConcurrency != null) {
+                                        try (Transaction tx = txs.txStart(txConcurrency,
txIsolation)) {
+                                            sndCache0.put(key, i);
+
+                                            tx.commit();
+                                        }
+                                        catch (CacheException | IgniteException e) {
+                                            if (!X.hasCause(e, ClusterTopologyCheckedException.class))
{
+                                                log.error("Unexpected error: " + e);
+
+                                                throw e;
+                                            }
 
-                                    expVals.put(key, F.t(i));
+                                            failed = true;
+                                        }
+                                    }
+                                    else
+                                        sndCache0.put(key, i);
+
+                                    if (!failed)
+                                        expVals.put(key, F.t(i));
                                 }
                                 else {
-                                    sndCache0.remove(key);
+                                    boolean failed = false;
+
+                                    if (txConcurrency != null) {
+                                        try (Transaction tx = txs.txStart(txConcurrency,
txIsolation)) {
+                                            sndCache0.remove(key);
+
+                                            tx.commit();
+                                        }
+                                        catch (CacheException | IgniteException e) {
+                                            if (!X.hasCause(e, ClusterTopologyCheckedException.class))
{
+                                                log.error("Unexpected error: " + e);
+
+                                                throw e;
+                                            }
+
+                                            failed = true;
+                                        }
+                                    }
+                                    else
+                                        sndCache0.remove(key);
 
-                                    expVals.put(key, F.<Integer>t(null));
+                                    if (!failed)
+                                        expVals.put(key, F.<Integer>t(null));
                                 }
 
                                 break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
index 8500e97..263c453 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
@@ -58,6 +58,7 @@ import static org.apache.ignite.testframework.GridTestUtils.setMemoryMode;
 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;
+import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
 
 /**
  *
@@ -175,6 +176,13 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
     /**
      * @throws Exception If failed.
      */
+    public void _testCrossCacheOptimisticSerializableTxFailover() throws Exception {
+        crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, SERIALIZABLE, TestMemoryMode.HEAP);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testCrossCacheOptimisticTxFailoverOffheapSwap() throws Exception {
         crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.OFFHEAP_EVICT_SWAP);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
index 9546d61..02aa824 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
@@ -31,6 +31,7 @@ public class GridCacheNearTxExceptionSelfTest extends IgniteTxExceptionAbstractS
         return PARTITIONED;
     }
 
+    /** {@inheritDoc} */
     @Override public void testTransformBackup(){
         fail("https://issues.apache.org/jira/browse/IGNITE-1601");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0dde0ac2/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
index cc5226f..f50a732 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/swapspace/inmemory/GridTestSwapSpaceSpi.java
@@ -180,6 +180,14 @@ public class GridTestSwapSpaceSpi extends IgniteSpiAdapter implements
SwapSpaceS
     }
 
     /**
+     *
+     */
+    public void clearAll() {
+        for (Space space : spaces.values())
+            space.clear();
+    }
+
+    /**
      * Gets space, creates if does not exist.
      *
      * @param spaceName Space name.


Mime
View raw message