Repository: ignite
Updated Branches:
  refs/heads/master 9edd7861f -> bc895ac62


IGNITE-10368: MVCC: Create "Cache 9" test suite for MVCC mode. This closes 
#5556.


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

Branch: refs/heads/master
Commit: bc895ac62f8049ac52f007cf80b23d1296198ad9
Parents: 9edd786
Author: Andrey V. Mashenkov <andrey.mashen...@gmail.com>
Authored: Wed Dec 5 16:26:35 2018 +0300
Committer: Igor Seliverstov <gvvinbl...@gmail.com>
Committed: Wed Dec 5 16:26:35 2018 +0300

----------------------------------------------------------------------
 .../processors/cache/CachePutIfAbsentTest.java  |  4 +
 .../distributed/IgniteCachePrimarySyncTest.java | 53 +++++++----
 .../IgniteTxCachePrimarySyncTest.java           | 96 +++++++++++++++++---
 ...teSynchronizationModesMultithreadedTest.java | 78 +++++++++-------
 .../IgniteTxConcurrentRemoveObjectsTest.java    | 52 ++++++++---
 .../testsuites/IgniteCacheMvccTestSuite9.java   | 57 ++++++++++++
 .../testsuites/IgniteCacheTestSuite9.java       | 33 ++++---
 7 files changed, 283 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
index 00ba25f..a70d3c3 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 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.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -129,6 +130,9 @@ public class CachePutIfAbsentTest extends 
GridCommonAbstractTest {
 
                     for (TransactionConcurrency concurrency : 
TransactionConcurrency.values()) {
                         for (TransactionIsolation isolation : 
TransactionIsolation.values()) {
+                            if (MvccFeatureChecker.forcedMvcc() && 
!MvccFeatureChecker.isSupported(concurrency, isolation))
+                                continue;
+
                             try (Transaction tx = txs.txStart(concurrency, 
isolation)) {
                                 Object old = cache.getAndPutIfAbsent(key, 3);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
index e9e22ee..2482a8e 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 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.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -35,6 +36,7 @@ import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static 
org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT;
 import static 
org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
 import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
 import static 
org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -53,6 +55,15 @@ public class IgniteCachePrimarySyncTest extends 
GridCommonAbstractTest {
     private static final int SRVS = 4;
 
     /** */
+    private static final String ATOMIC_CACHE = "atomicCache";
+
+    /** */
+    private static final String TX_CACHE = "txCache";
+
+    /** */
+    private static final String MVCC_CACHE = "mvccCache";
+
+    /** */
     private boolean clientMode;
 
     /** {@inheritDoc} */
@@ -61,19 +72,22 @@ public class IgniteCachePrimarySyncTest extends 
GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration<Object, Object> ccfg1 = new 
CacheConfiguration<>(DEFAULT_CACHE_NAME);
-        ccfg1.setName("cache1");
-        ccfg1.setAtomicityMode(ATOMIC);
-        ccfg1.setBackups(2);
-        ccfg1.setWriteSynchronizationMode(PRIMARY_SYNC);
+        CacheConfiguration<Object, Object> ccfg1 = new 
CacheConfiguration<>(ATOMIC_CACHE)
+            .setAtomicityMode(ATOMIC)
+            .setBackups(2)
+            .setWriteSynchronizationMode(PRIMARY_SYNC);
+
+        CacheConfiguration<Object, Object> ccfg2 = new 
CacheConfiguration<>(TX_CACHE)
+            .setAtomicityMode(TRANSACTIONAL)
+            .setBackups(2)
+            .setWriteSynchronizationMode(PRIMARY_SYNC);
 
-        CacheConfiguration<Object, Object> ccfg2 = new 
CacheConfiguration<>(DEFAULT_CACHE_NAME);
-        ccfg2.setName("cache2");
-        ccfg2.setAtomicityMode(TRANSACTIONAL);
-        ccfg2.setBackups(2);
-        ccfg2.setWriteSynchronizationMode(PRIMARY_SYNC);
+        CacheConfiguration<Object, Object> ccfg3 = new 
CacheConfiguration<>(MVCC_CACHE)
+            .setAtomicityMode(TRANSACTIONAL_SNAPSHOT)
+            .setBackups(2)
+            .setWriteSynchronizationMode(PRIMARY_SYNC);
 
-        cfg.setCacheConfiguration(ccfg1, ccfg2);
+        cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
 
         cfg.setClientMode(clientMode);
 
@@ -97,17 +111,24 @@ public class IgniteCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testPutGet() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10520";);
+
         Ignite ignite = ignite(SRVS);
 
-        checkPutGet(ignite.cache("cache1"), null, null, null);
+        checkPutGet(ignite.cache(ATOMIC_CACHE), null, null, null);
+
+        checkPutGet(ignite.cache(TX_CACHE), null, null, null);
+
+        checkPutGet(ignite.cache(MVCC_CACHE), null, null, null);
 
-        checkPutGet(ignite.cache("cache2"), null, null, null);
+        checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), OPTIMISTIC, 
REPEATABLE_READ);
 
-        checkPutGet(ignite.cache("cache2"), ignite.transactions(), OPTIMISTIC, 
REPEATABLE_READ);
+        checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), OPTIMISTIC, 
SERIALIZABLE);
 
-        checkPutGet(ignite.cache("cache2"), ignite.transactions(), OPTIMISTIC, 
SERIALIZABLE);
+        checkPutGet(ignite.cache(TX_CACHE), ignite.transactions(), 
PESSIMISTIC, READ_COMMITTED);
 
-        checkPutGet(ignite.cache("cache2"), ignite.transactions(), 
PESSIMISTIC, READ_COMMITTED);
+        checkPutGet(ignite.cache(MVCC_CACHE), ignite.transactions(), 
PESSIMISTIC, REPEATABLE_READ);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
index bdf0b12..ceed9b8 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
@@ -58,6 +58,8 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
+import org.apache.ignite.testframework.MvccFeatureChecker.Feature;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
@@ -134,6 +136,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSingleKeyCommitFromPrimary() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10518";);
+
         singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, 
PRIMARY_SYNC, 1, true, false));
 
         singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, 
PRIMARY_SYNC, 2, false, false));
@@ -148,6 +153,16 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void singleKeyCommitFromPrimary(CacheConfiguration<Object, Object> 
ccfg) throws Exception {
+        if (MvccFeatureChecker.forcedMvcc()) {
+            if (ccfg.getCacheStoreFactory() != null &&
+                !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+                return;
+
+            if (ccfg.getNearConfiguration() != null &&
+                !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+                return;
+        }
+
         Ignite ignite = ignite(0);
 
         IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
@@ -164,6 +179,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
 
                 for (final TransactionConcurrency concurrency : 
TransactionConcurrency.values()) {
                     for (final TransactionIsolation isolation : 
TransactionIsolation.values()) {
+                        if (MvccFeatureChecker.forcedMvcc() && 
!MvccFeatureChecker.isSupported(concurrency, isolation))
+                            continue;
+
                         singleKeyCommitFromPrimary(node, ccfg, new 
IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
                             @Override public void apply(Integer key, 
IgniteCache<Object, Object> cache) {
                                 Ignite ignite = cache.unwrap(Ignite.class);
@@ -266,12 +284,19 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void singleKeyPrimaryNodeLeft(CacheConfiguration<Object, Object> 
ccfg) throws Exception {
+        if (MvccFeatureChecker.forcedMvcc()) {
+            if (ccfg.getCacheStoreFactory() != null &&
+                !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+                return;
+        }
+
         Ignite ignite = ignite(0);
 
         IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
 
         try {
-            ignite(NODES - 1).createNearCache(ccfg.getName(), new 
NearCacheConfiguration<>());
+            if (!MvccFeatureChecker.forcedMvcc() || 
MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+                ignite(NODES - 1).createNearCache(ccfg.getName(), new 
NearCacheConfiguration<>());
 
             for (int i = 0; i < NODES; i++) {
                 Ignite node = ignite(i);
@@ -284,6 +309,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
 
                 for (final TransactionConcurrency concurrency : 
TransactionConcurrency.values()) {
                     for (final TransactionIsolation isolation : 
TransactionIsolation.values()) {
+                        if (MvccFeatureChecker.forcedMvcc() && 
!MvccFeatureChecker.isSupported(concurrency, isolation))
+                            continue;
+
                         singleKeyPrimaryNodeLeft(node, ccfg, new 
IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
                             @Override public void apply(Integer key, 
IgniteCache<Object, Object> cache) {
                                 Ignite ignite = cache.unwrap(Ignite.class);
@@ -372,6 +400,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSingleKeyCommit() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-10518";);
+
         singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 
1, true, false));
 
         singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 
2, false, false));
@@ -386,12 +417,23 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void singleKeyCommit(CacheConfiguration<Object, Object> ccfg) 
throws Exception {
+        if (MvccFeatureChecker.forcedMvcc()) {
+            if (ccfg.getCacheStoreFactory() != null &&
+                !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+                return;
+
+            if (ccfg.getNearConfiguration() != null &&
+                !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+                return;
+        }
+
         Ignite ignite = ignite(0);
 
         IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
 
         try {
-            ignite(NODES - 1).createNearCache(ccfg.getName(), new 
NearCacheConfiguration<>());
+            if (!MvccFeatureChecker.forcedMvcc() || 
MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+                ignite(NODES - 1).createNearCache(ccfg.getName(), new 
NearCacheConfiguration<>());
 
             for (int i = 1; i < NODES; i++) {
                 Ignite node = ignite(i);
@@ -406,6 +448,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
 
                 for (final TransactionConcurrency concurrency : 
TransactionConcurrency.values()) {
                     for (final TransactionIsolation isolation : 
TransactionIsolation.values()) {
+                        if (MvccFeatureChecker.forcedMvcc() && 
!MvccFeatureChecker.isSupported(concurrency, isolation))
+                            continue;
+
                         singleKeyCommit(node, ccfg, new 
IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
                             @Override public void apply(Integer key, 
IgniteCache<Object, Object> cache) {
                                 Ignite ignite = cache.unwrap(Ignite.class);
@@ -528,12 +573,23 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void checkWaitPrimaryResponse(CacheConfiguration<Object, Object> 
ccfg) throws Exception {
+        if (MvccFeatureChecker.forcedMvcc()) {
+            if (ccfg.getCacheStoreFactory() != null &&
+                !MvccFeatureChecker.isSupported(Feature.CACHE_STORE))
+                return;
+
+            if (ccfg.getNearConfiguration() != null &&
+                !MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+                return;
+        }
+
         Ignite ignite = ignite(0);
 
         IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
 
         try {
-            ignite(NODES - 1).createNearCache(ccfg.getName(), new 
NearCacheConfiguration<>());
+            if (!MvccFeatureChecker.forcedMvcc() || 
MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
+                ignite(NODES - 1).createNearCache(ccfg.getName(), new 
NearCacheConfiguration<>());
 
             for (int i = 1; i < NODES; i++) {
                 Ignite node = ignite(i);
@@ -561,6 +617,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
 
                 for (final TransactionConcurrency concurrency : 
TransactionConcurrency.values()) {
                     for (final TransactionIsolation isolation : 
TransactionIsolation.values()) {
+                        if (MvccFeatureChecker.forcedMvcc() && 
!MvccFeatureChecker.isSupported(concurrency, isolation))
+                            continue;
+
                         checkWaitPrimaryResponse(node, ccfg, new 
IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
                             @Override public void apply(Integer key, 
IgniteCache<Object, Object> cache) {
                                 Ignite ignite = cache.unwrap(Ignite.class);
@@ -652,6 +711,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testOnePhaseMessages() throws Exception {
+        if (MvccFeatureChecker.forcedMvcc())
+            return; // Not supported. Commit flow differs for Mvcc mode.
+
         checkOnePhaseMessages(cacheConfiguration(DEFAULT_CACHE_NAME, 
PRIMARY_SYNC, 1, false, false));
     }
 
@@ -678,6 +740,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
 
                 for (final TransactionConcurrency concurrency : 
TransactionConcurrency.values()) {
                     for (final TransactionIsolation isolation : 
TransactionIsolation.values()) {
+                        if (MvccFeatureChecker.forcedMvcc() && 
!MvccFeatureChecker.isSupported(concurrency, isolation))
+                            continue;
+
                         checkOnePhaseMessages(node, ccfg, new 
IgniteBiInClosure<Integer, IgniteCache<Object, Object>>() {
                             @Override public void apply(Integer key, 
IgniteCache<Object, Object> cache) {
                                 Ignite ignite = cache.unwrap(Ignite.class);
@@ -760,12 +825,13 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
         List<IgniteCache<Object, Object>> caches = new ArrayList<>();
 
         try {
-            caches.add(createCache(ignite, cacheConfiguration("fullSync1", 
FULL_SYNC, 1, false, false), true));
-            caches.add(createCache(ignite, cacheConfiguration("fullSync2", 
FULL_SYNC, 1, false, false), true));
-            caches.add(createCache(ignite, cacheConfiguration("fullAsync1", 
FULL_ASYNC, 1, false, false), true));
-            caches.add(createCache(ignite, cacheConfiguration("fullAsync2", 
FULL_ASYNC, 1, false, false), true));
-            caches.add(createCache(ignite, cacheConfiguration("primarySync1", 
PRIMARY_SYNC, 1, false, false), true));
-            caches.add(createCache(ignite, cacheConfiguration("primarySync2", 
PRIMARY_SYNC, 1, false, false), true));
+
+            caches.add(createCache(ignite, cacheConfiguration("fullSync1", 
FULL_SYNC, 1, false, false)));
+            caches.add(createCache(ignite, cacheConfiguration("fullSync2", 
FULL_SYNC, 1, false, false)));
+            caches.add(createCache(ignite, cacheConfiguration("fullAsync1", 
FULL_ASYNC, 1, false, false)));
+            caches.add(createCache(ignite, cacheConfiguration("fullAsync2", 
FULL_ASYNC, 1, false, false)));
+            caches.add(createCache(ignite, cacheConfiguration("primarySync1", 
PRIMARY_SYNC, 1, false, false)));
+            caches.add(createCache(ignite, cacheConfiguration("primarySync2", 
PRIMARY_SYNC, 1, false, false)));
 
             for (int i = 0; i < NODES; i++) {
                 checkTxSyncMode(ignite(i), true);
@@ -805,7 +871,8 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
      * @param key Cache key.
      * @throws Exception If failed.
      */
-    private void waitKeyUpdated(Ignite ignite, int expNodes, final String 
cacheName, final Object key) throws Exception {
+    private void waitKeyUpdated(Ignite ignite, int expNodes, final String 
cacheName,
+        final Object key) throws Exception {
         Affinity<Object> aff = ignite.affinity(cacheName);
 
         final Collection<ClusterNode> nodes = 
aff.mapKeyToPrimaryAndBackups(key);
@@ -834,14 +901,12 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
     /**
      * @param ignite Node.
      * @param ccfg Cache configuration.
-     * @param nearCache If {@code true} creates near cache on one of client 
nodes.
      * @return Created cache.
      */
-    private <K, V> IgniteCache<K, V> createCache(Ignite ignite, 
CacheConfiguration<K, V> ccfg,
-        boolean nearCache) {
+    private <K, V> IgniteCache<K, V> createCache(Ignite ignite, 
CacheConfiguration<K, V> ccfg) {
         IgniteCache<K, V> cache = ignite.createCache(ccfg);
 
-        if (nearCache)
+        if (!MvccFeatureChecker.forcedMvcc() || 
MvccFeatureChecker.isSupported(Feature.NEAR_CACHE))
             ignite(NODES - 1).createNearCache(ccfg.getName(), new 
NearCacheConfiguration<>());
 
         return cache;
@@ -866,6 +931,9 @@ public class IgniteTxCachePrimarySyncTest extends 
GridCommonAbstractTest {
 
             for (TransactionConcurrency concurrency : 
TransactionConcurrency.values()) {
                 for (TransactionIsolation isolation : 
TransactionIsolation.values()) {
+                    if (MvccFeatureChecker.forcedMvcc() && 
!MvccFeatureChecker.isSupported(concurrency, isolation))
+                        continue;
+
                     try (Transaction tx = txs.txStart(concurrency, isolation)) 
{
                         fullSync1.put(key++, 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
index bd552c2..86d20db 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
@@ -32,7 +32,6 @@ import javax.cache.integration.CacheWriterException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteSystemProperties;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cache.store.CacheStore;
 import org.apache.ignite.cache.store.CacheStoreAdapter;
@@ -51,6 +50,7 @@ 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.testframework.GridTestUtils;
+import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionOptimisticException;
@@ -107,24 +107,26 @@ public class 
IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
-        super.beforeTestsStarted();
+        if (MvccFeatureChecker.forcedMvcc())
+            fail("https://issues.apache.org/jira/browse/IGNITE-9470";);
 
-        
System.setProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL,"true");
+        super.beforeTestsStarted();
 
-        startGrids(SRVS);
+        startGridsMultiThreaded(SRVS);
 
         clientMode = true;
 
-        for (int i = 0; i < CLIENTS; i++) {
-            Ignite client = startGrid(SRVS + i);
+        startGridsMultiThreaded(SRVS, CLIENTS);
 
-            assertTrue(client.configuration().isClientMode());
-        }
+        for (int i = 0; i < CLIENTS; i++)
+            assertTrue(grid(SRVS + i).configuration().isClientMode());
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTestsStopped() throws Exception {
-        
System.clearProperty(IgniteSystemProperties.IGNITE_ENABLE_FORCIBLE_NODE_KILL);
+        stopAllGrids();
+
+        super.afterTestsStopped();
     }
 
     /** {@inheritDoc} */
@@ -202,6 +204,14 @@ public class 
IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
         boolean store,
         boolean nearCache,
         boolean restart) throws Exception {
+        if (MvccFeatureChecker.forcedMvcc()) {
+            if (store && 
!MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE))
+                return;
+
+            if (nearCache && 
!MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE))
+                return;
+        }
+
         final Ignite ignite = ignite(0);
 
         createCache(ignite, cacheConfiguration(DEFAULT_CACHE_NAME, syncMode, 
backups, store), nearCache);
@@ -278,36 +288,38 @@ public class 
IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
                 }
             });
 
-            commitMultithreaded(new IgniteBiInClosure<Ignite, 
IgniteCache<Integer, Integer>>() {
-                @Override public void apply(Ignite ignite, 
IgniteCache<Integer, Integer> cache) {
-                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
-                    Map<Integer, Integer> map = new LinkedHashMap<>();
-
-                    for (int i = 0; i < 10; i++) {
-                        Integer key = rnd.nextInt(MULTITHREADED_TEST_KEYS);
-
-                        map.put(key, rnd.nextInt());
-                    }
+            if (!MvccFeatureChecker.forcedMvcc()) {
+                commitMultithreaded(new IgniteBiInClosure<Ignite, 
IgniteCache<Integer, Integer>>() {
+                    @Override public void apply(Ignite ignite, 
IgniteCache<Integer, Integer> cache) {
+                        ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
-                    while (true) {
-                        try (Transaction tx = 
ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) {
-                            for (Map.Entry<Integer, Integer> e : 
map.entrySet())
-                                cache.put(e.getKey(), e.getValue());
+                        Map<Integer, Integer> map = new LinkedHashMap<>();
 
-                            tx.commit();
+                        for (int i = 0; i < 10; i++) {
+                            Integer key = rnd.nextInt(MULTITHREADED_TEST_KEYS);
 
-                            break;
-                        }
-                        catch (TransactionOptimisticException ignored) {
-                           // Retry.
+                            map.put(key, rnd.nextInt());
                         }
-                        catch (CacheException | IgniteException ignored) {
-                            break;
+
+                        while (true) {
+                            try (Transaction tx = 
ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE)) {
+                                for (Map.Entry<Integer, Integer> e : 
map.entrySet())
+                                    cache.put(e.getKey(), e.getValue());
+
+                                tx.commit();
+
+                                break;
+                            }
+                            catch (TransactionOptimisticException ignored) {
+                                // Retry.
+                            }
+                            catch (CacheException | IgniteException ignored) {
+                                break;
+                            }
                         }
                     }
-                }
-            });
+                });
+            }
         }
         finally {
             stop.set(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
index a5b2cb7..cd5cbe6 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConcurrentRemoveObjectsTest.java
@@ -36,9 +36,11 @@ 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 org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
 
 import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_REMOVED_ENTRIES_TTL;
-import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static 
org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
 import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
 
 /**
@@ -67,25 +69,22 @@ public class IgniteTxConcurrentRemoveObjectsTest extends 
GridCommonAbstractTest
         oldIgniteCacheRmvEntriesTtl = 
Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000);
 
         System.setProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 
Long.toString(newIgniteCacheRemovedEntriesTtl));
+
+        startGrid(0);
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
         System.setProperty(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 
Long.toString(oldIgniteCacheRmvEntriesTtl));
 
         super.afterTestsStopped();
     }
 
     /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        super.beforeTest();
-
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        stopAllGrids();
+        grid(0).destroyCache(DEFAULT_CACHE_NAME);
 
         super.afterTest();
     }
@@ -102,7 +101,7 @@ public class IgniteTxConcurrentRemoveObjectsTest extends 
GridCommonAbstractTest
     /**
      * @return Cache configuration.
      */
-    private CacheConfiguration<Integer, String> getCacheCfg() {
+    private CacheConfiguration<Integer, String> cacheConfiguration() {
         CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
 
         ccfg.setName(DEFAULT_CACHE_NAME);
@@ -115,16 +114,39 @@ public class IgniteTxConcurrentRemoveObjectsTest extends 
GridCommonAbstractTest
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testOptimisticTxLeavesObjectsInLocalPartition() throws 
Exception {
+        checkTxLeavesObjectsInLocalPartition(cacheConfiguration(), 
TransactionConcurrency.OPTIMISTIC, SERIALIZABLE);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPessimisticTxLeavesObjectsInLocalPartition() throws 
Exception {
+        checkTxLeavesObjectsInLocalPartition(cacheConfiguration(), 
TransactionConcurrency.PESSIMISTIC, SERIALIZABLE);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMvccTxLeavesObjectsInLocalPartition() throws Exception {
+        
checkTxLeavesObjectsInLocalPartition(cacheConfiguration().setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT),
+            TransactionConcurrency.PESSIMISTIC, REPEATABLE_READ);
+    }
+
+    /**
      * Too many deletes in single transaction may overflow {@link 
GridDhtLocalPartition#rmvQueue} and entries will be
      * deleted synchronously in {@link 
GridDhtLocalPartition#onDeferredDelete(int, KeyCacheObject, GridCacheVersion)}.
      * This should not corrupt internal map state in {@link 
GridDhtLocalPartition}.
      *
      * @throws Exception If failed.
      */
-    public void testTxLeavesObjectsInLocalPartition() throws Exception {
-        IgniteEx igniteEx = startGrid(getConfiguration());
+    public void 
checkTxLeavesObjectsInLocalPartition(CacheConfiguration<Integer, String> ccfg,
+        TransactionConcurrency optimistic, TransactionIsolation isolation) 
throws Exception {
+        IgniteEx igniteEx = grid(0);
 
-        igniteEx.getOrCreateCache(getCacheCfg());
+        igniteEx.getOrCreateCache(ccfg);
 
         try (IgniteDataStreamer<Integer, String> dataStreamer = 
igniteEx.dataStreamer(DEFAULT_CACHE_NAME)) {
             for (int i = 0; i < CACHE_ENTRIES_COUNT; i++)
@@ -141,8 +163,8 @@ public class IgniteTxConcurrentRemoveObjectsTest extends 
GridCommonAbstractTest
 
         assertEquals(CACHE_ENTRIES_COUNT, 
client.getOrCreateCache(DEFAULT_CACHE_NAME).size());
 
-        try (Transaction tx = client.transactions().txStart(OPTIMISTIC, 
SERIALIZABLE)) {
-            IgniteCache<Integer, String> cache = 
client.getOrCreateCache(getCacheCfg());
+        try (Transaction tx = client.transactions().txStart(optimistic, 
isolation)) {
+            IgniteCache<Integer, String> cache = 
client.getOrCreateCache(cacheConfiguration());
 
             for (int v = 0; v < CACHE_ENTRIES_COUNT; v++) {
                 cache.get(v);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java
new file mode 100644
index 0000000..17a9421
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheMvccTestSuite9.java
@@ -0,0 +1,57 @@
+/*
+ * 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.testsuites;
+
+import java.util.Collection;
+import java.util.HashSet;
+import junit.framework.TestSuite;
+import org.apache.ignite.IgniteSystemProperties;
+import 
org.apache.ignite.internal.processors.cache.IgniteCacheGetCustomCollectionsSelfTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteCacheLoadRebalanceEvictionSelfTest;
+import 
org.apache.ignite.internal.processors.cache.distributed.CacheAtomicPrimarySyncBackPressureTest;
+import 
org.apache.ignite.internal.processors.cache.distributed.IgniteTxConcurrentRemoveObjectsTest;
+
+/**
+ * Test suite.
+ */
+public class IgniteCacheMvccTestSuite9 extends TestSuite {
+    /**
+     * @return IgniteCache test suite.
+     */
+    public static TestSuite suite() {
+        
System.setProperty(IgniteSystemProperties.IGNITE_FORCE_MVCC_MODE_IN_TESTS, 
"true");
+
+        Collection<Class> ignoredTests = new HashSet<>();
+
+        // Skip classes that already contains Mvcc tests
+        ignoredTests.add(IgniteTxConcurrentRemoveObjectsTest.class);
+
+        // Atomic caches.
+        ignoredTests.add(CacheAtomicPrimarySyncBackPressureTest.class);
+
+        // Other non-tx tests.
+        ignoredTests.add(IgniteCacheGetCustomCollectionsSelfTest.class);
+        ignoredTests.add(IgniteCacheLoadRebalanceEvictionSelfTest.class);
+
+        TestSuite suite = new TestSuite("IgniteCache Mvcc Test Suite part 9");
+
+        suite.addTest(IgniteCacheTestSuite9.suite(ignoredTests));
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bc895ac6/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
index 157673e..23d71c1 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite9.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.testsuites;
 
+import java.util.Collection;
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.CachePutIfAbsentTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheGetCustomCollectionsSelfTest;
@@ -28,6 +29,7 @@ import 
org.apache.ignite.internal.processors.cache.distributed.IgniteTxCachePrim
 import 
org.apache.ignite.internal.processors.cache.distributed.IgniteTxCacheWriteSynchronizationModesMultithreadedTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.IgniteTxConcurrentRemoveObjectsTest;
 import 
org.apache.ignite.internal.processors.cache.transactions.TxDataConsistencyOnCommitFailureTest;
+import org.apache.ignite.testframework.GridTestUtils;
 
 /**
  * Test suite.
@@ -35,25 +37,32 @@ import 
org.apache.ignite.internal.processors.cache.transactions.TxDataConsistenc
 public class IgniteCacheTestSuite9 extends TestSuite {
     /**
      * @return IgniteCache test suite.
-     * @throws Exception Thrown in case of the failure.
      */
-    public static TestSuite suite() throws Exception {
+    public static TestSuite suite() {
+        return suite(null);
+    }
+
+    /**
+     * @param ignoredTests Ignored tests.
+     * @return IgniteCache test suite.
+     */
+    public static TestSuite suite(Collection<Class> ignoredTests) {
         TestSuite suite = new TestSuite("IgniteCache Test Suite part 9");
 
-        suite.addTestSuite(IgniteCacheGetCustomCollectionsSelfTest.class);
-        suite.addTestSuite(IgniteCacheLoadRebalanceEvictionSelfTest.class);
-        suite.addTestSuite(IgniteCachePrimarySyncTest.class);
-        suite.addTestSuite(IgniteTxCachePrimarySyncTest.class);
-        
suite.addTestSuite(IgniteTxCacheWriteSynchronizationModesMultithreadedTest.class);
-        suite.addTestSuite(CachePutIfAbsentTest.class);
+        GridTestUtils.addTestIfNeeded(suite, 
IgniteCacheGetCustomCollectionsSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, 
IgniteCacheLoadRebalanceEvictionSelfTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, IgniteCachePrimarySyncTest.class, 
ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, 
IgniteTxCachePrimarySyncTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, 
IgniteTxCacheWriteSynchronizationModesMultithreadedTest.class, ignoredTests);
+        GridTestUtils.addTestIfNeeded(suite, CachePutIfAbsentTest.class, 
ignoredTests);
 
-        suite.addTestSuite(CacheAtomicPrimarySyncBackPressureTest.class);
+        GridTestUtils.addTestIfNeeded(suite, 
CacheAtomicPrimarySyncBackPressureTest.class, ignoredTests);
 
-        suite.addTestSuite(IgniteTxConcurrentRemoveObjectsTest.class);
+        GridTestUtils.addTestIfNeeded(suite, 
IgniteTxConcurrentRemoveObjectsTest.class, ignoredTests);
 
-        suite.addTestSuite(TxDataConsistencyOnCommitFailureTest.class);
+        GridTestUtils.addTestIfNeeded(suite, 
TxDataConsistencyOnCommitFailureTest.class, ignoredTests);
 
-        suite.addTestSuite(CacheOperationsInterruptTest.class);
+        GridTestUtils.addTestIfNeeded(suite, 
CacheOperationsInterruptTest.class, ignoredTests);
 
         return suite;
     }

Reply via email to