http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java deleted file mode 100644 index da25288..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CashEventWithTxLabelTest.java +++ /dev/null @@ -1,487 +0,0 @@ -/* - * 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; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.cache.CacheEntryProcessor; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.events.CacheEvent; -import org.apache.ignite.events.Event; -import org.apache.ignite.internal.IgniteKernal; -import org.apache.ignite.internal.util.lang.IgnitePair; -import org.apache.ignite.lang.IgnitePredicate; -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.junit.Assert; - -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ; -import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED; - -/** - * Test to check passing transaction's label for EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_PUT, - * EVT_CACHE_OBJECT_REMOVED events. - */ -public class CashEventWithTxLabelTest extends GridCommonAbstractTest { - /** Types event to be checked. */ - private static final int[] CACHE_EVENT_TYPES = {EVT_CACHE_OBJECT_READ, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED}; - - /** Transaction label. */ - private static final String TX_LABEL = "TX_LABEL"; - - /** Number of server nodes. */ - private static final int SRVS = 3; - - /** Number of client nodes. */ - private static final int CLIENTS = 1; - - /** Cache name. */ - public static final String CACHE_NAME = "cache"; - - /** Client or server mode to start Ignite instance. */ - private static boolean client; - - /** Key related to primary node. */ - private Integer primaryKey = 0; - - /** Key related to backup node. */ - private Integer backupKey = 0; - - /** Current cash backup count. */ - private int backupCnt; - - /** Current transaction isolation level. */ - private TransactionIsolation isolation; - - /** Current transaction concurrency level. */ - private TransactionConcurrency concurrency; - - /** All failed tests information, */ - private ArrayList<String> errors = new ArrayList<>(); - - /** Count of errors on previous iteration of testing. */ - private int prevErrCnt = 0; - - /** List to keep all events with no tx label between run tests */ - private static List<CacheEvent> wrongEvts = Collections.synchronizedList(new ArrayList<>()); - - /** Simple entry processor to use for tests */ - private static CacheEntryProcessor entryProcessor = (CacheEntryProcessor)(entry, objects) -> entry.getValue(); - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { - return super.getConfiguration(igniteInstanceName).setClientMode(client); - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); - - client = false; - - startGridsMultiThreaded(SRVS); - - client = true; - - startGridsMultiThreaded(SRVS, CLIENTS); - - client = false; - - waitForDiscovery(primary(), backup1(), backup2(), client()); - - registerEventListeners(primary(), backup1(), backup2(), client()); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - super.afterTestsStopped(); - - stopAllGrids(); - } - - /** - * Check all cases for passing transaction label in cash event. - * - * @throws Exception If failed. - */ - public void testPassTxLabelInCashEventForAllCases() throws Exception { - Ignite[] nodes = {client(), primary(), backup1(), backup2()}; - - for (int backupCnt = 0; backupCnt < SRVS; backupCnt++) { - this.backupCnt = backupCnt; - - prepareCache(backupCnt); - - for (TransactionIsolation isolation : TransactionIsolation.values()) { - this.isolation = isolation; - - for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { - this.concurrency = concurrency; - - for (int i = 0; i < nodes.length - 1; i++) { - Ignite nodeForPut = nodes[i]; - Ignite nodeForGet = nodes[i + 1]; - - singleWriteReadRemoveTest(nodeForPut, nodeForGet); - - multiWriteReadRemoveTest(nodeForPut, nodeForGet); - - singleNodeBatchWriteReadRemoveTest(nodeForPut, nodeForGet); - - multiNodeBatchWriteReadRemoveTest(nodeForPut, nodeForGet); - - writeInvokeRemoveTest(nodeForPut, nodeForGet); - - writeInvokeAllRemoveTest(nodeForPut, nodeForGet); - } - } - } - } - - String listOfFailedTests = String.join(",\n", errors); - - Assert.assertTrue("Have been received " + prevErrCnt + " cache events with incorrect txlabel.\n" + - "Failed tests:" + listOfFailedTests, - errors.isEmpty()); - } - - /** - * Check error after run test. In case error occured information about failed test will be added to errors list. - * - * @param testName Name of test which result will be checked. - * @param node1 First node - * @param node2 Second node - */ - private void checkResult(String testName, Ignite node1, Ignite node2) { - int currErrCnt = wrongEvts.size(); - - if (prevErrCnt != currErrCnt) { - prevErrCnt = currErrCnt; - - errors.add(String.format("%s backCnt-%s, %s, %s, node1-%s, node2-%s", - testName, backupCnt, isolation, concurrency, nodeType(node1), nodeType(node2))); - } - } - - /** - * @param node Ignite node - * @return Node type in the test - */ - private String nodeType(Ignite node) { - if (client().equals(node)) - return "CLIENT"; - else if (primary().equals(node)) - return "PRIMARY"; - else if (backup1().equals(node)) - return "BACKUP1"; - else if (backup2().equals(node)) - return "BACKUP2"; - else - return "UNKNOWN"; - } - - /** - * Test single put, get, remove operations. - * - * @param instanceToPut Ignite instance to put test data. - * @param instanceToGet Ignite instance to get test data. - */ - private void singleWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) { - runTransactionally(instanceToPut, (Ignite ign) -> { - ign.cache(CACHE_NAME).put(primaryKey, 3); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).get(primaryKey); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).remove(primaryKey); - }); - - checkResult("singleWriteReadRemoveTest", instanceToPut, instanceToGet); - } - - /** - * Test multi put, get, remove operations - * - * @param instanceToPut Ignite instance to put test data. - * @param instanceToGet Ignite instance to get test data. - */ - private void multiWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) { - runTransactionally(instanceToPut, (Ignite ign) -> { - ign.cache(CACHE_NAME).put(primaryKey, 2); - ign.cache(CACHE_NAME).put(backupKey, 3); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).get(primaryKey); - ign.cache(CACHE_NAME).get(backupKey); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).remove(primaryKey); - ign.cache(CACHE_NAME).remove(backupKey); - }); - - checkResult("multiWriteReadRemoveTest", instanceToPut, instanceToGet); - } - - /** - * Test multi nodes batch write-read - * - * @param instanceToPut Ignite instance to put test data. - * @param instanceToGet Ignite instance to get test data. - */ - private void multiNodeBatchWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) { - Map<Integer, Integer> keyValuesMap = IntStream.range(0, 100).boxed() - .collect(Collectors.toMap(Function.identity(), Function.identity())); - - runTransactionally(instanceToPut, (Ignite ign) -> { - ign.cache(CACHE_NAME).putAll(keyValuesMap); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).getAll(keyValuesMap.keySet()); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet()); - }); - - checkResult("multiNodeBatchWriteReadRemoveTest", instanceToPut, instanceToGet); - } - - /** - * Test single node batch write-read-remove - * - * @param instanceToPut Ignite instance to put test data. - * @param instanceToGet Ignite instance to get test data. - */ - private void singleNodeBatchWriteReadRemoveTest(Ignite instanceToPut, Ignite instanceToGet) { - IgnitePair<Integer> keys = evaluatePrimaryAndBackupKeys(primaryKey + 1, backupKey + 1); - - Map<Integer, Integer> keyValuesMap = new HashMap<>(); - keyValuesMap.put(primaryKey, 1); - keyValuesMap.put(keys.get1(), 2); - - runTransactionally(instanceToPut, (Ignite ign) -> { - ign.cache(CACHE_NAME).putAll(keyValuesMap); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).getAll(keyValuesMap.keySet()); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet()); - }); - - checkResult("oneNodeBatchWriteReadRemoveTest", instanceToPut, instanceToGet); - } - - /** - * Test put-invoke-remove - * - * @param instanceToPut Ignite instance to put test data. - * @param instanceToGet Ignite instance to get test data. - */ - @SuppressWarnings("unchecked") - private void writeInvokeRemoveTest(Ignite instanceToPut, Ignite instanceToGet) { - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).put(primaryKey, 3); - }); - - runTransactionally(instanceToPut, (Ignite ign) -> { - ign.cache(CACHE_NAME).invoke(primaryKey, entryProcessor); - ign.cache(CACHE_NAME).invoke(backupKey, entryProcessor); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).remove(primaryKey); - }); - - checkResult("writeInvokeRemoveTest", instanceToPut, instanceToGet); - } - - /** - * Test putAll-invokeAll-removeAll - * - * @param instanceToPut Ignite instance to put test data. - * @param instanceToGet Ignite instance to get test data. - */ - @SuppressWarnings("unchecked") - private void writeInvokeAllRemoveTest(Ignite instanceToPut, Ignite instanceToGet) { - Map<Integer, Integer> keyValuesMap = IntStream.range(0, 100).boxed() - .collect(Collectors.toMap(Function.identity(), Function.identity())); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).putAll(keyValuesMap); - }); - - runTransactionally(instanceToPut, (Ignite ign) -> { - ign.cache(CACHE_NAME).invokeAll(keyValuesMap.keySet(), entryProcessor); - }); - - runTransactionally(instanceToGet, (Ignite ign) -> { - ign.cache(CACHE_NAME).removeAll(keyValuesMap.keySet()); - }); - - checkResult("WriteInvokeAllRemoveTest", instanceToPut, instanceToGet); - } - - /** - * Run command in transaction. - * - * @param startNode Ignite node to start transaction and run passed command. - * @param cmdInTx Command which should be done in transaction. - */ - private void runTransactionally(Ignite startNode, Consumer<Ignite> cmdInTx) { - try (Transaction tx = startNode.transactions().withLabel(TX_LABEL).txStart(concurrency, isolation)) { - cmdInTx.accept(startNode); - - tx.commit(); - } - } - - /** - * Add event listener to passed Ignite instances for cache event types. - * - * @param igns Ignite instances. - */ - private void registerEventListeners(Ignite... igns) { - if (igns != null) { - for (Ignite ign : igns) { - ign.events().enableLocal(CACHE_EVENT_TYPES); - ign.events().localListen((IgnitePredicate<Event>)event -> { - CacheEvent cacheEvt = (CacheEvent)event; - - if (!TX_LABEL.equals(cacheEvt.txLabel())) { - log.error("Has been received event with incorrect label " + cacheEvt.txLabel() + " ," + - " expected " + TX_LABEL + " label"); - - wrongEvts.add(cacheEvt); - } - - return true; - }, CACHE_EVENT_TYPES); - } - } - } - - /** - * Create cache with passed number of backups and determinate primary and backup keys. If cache was created before - * it will be removed before create new one. - * - * @param cacheBackups Number of backups for cache. - * @throws InterruptedException In case of fail. - */ - private void prepareCache(int cacheBackups) throws InterruptedException { - IgniteCache<Object, Object> cache = client().cache(CACHE_NAME); - - if (cache != null) - cache.destroy(); - - client().createCache( - new CacheConfiguration<Integer, Integer>() - .setName(CACHE_NAME) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) - .setCacheMode(CacheMode.PARTITIONED) - .setBackups(cacheBackups) - ); - - awaitPartitionMapExchange(); - - IgnitePair<Integer> keys = evaluatePrimaryAndBackupKeys(0, 0); - - primaryKey = keys.get1(); - backupKey = keys.get2(); - } - - /** - * Evaluate primary and backup keys. - * - * @param primaryKeyStart Value from need to start calculate primary key. - * @param backupKeyStart Value from need to start calculate backup key. - * @return Pair of result. The first result is found primary key. The second is found backup key. - */ - private IgnitePair<Integer> evaluatePrimaryAndBackupKeys(final int primaryKeyStart, final int backupKeyStart) { - int primaryKey = primaryKeyStart; - int backupKey = backupKeyStart; - - while (!client().affinity(CACHE_NAME).isPrimary(((IgniteKernal)primary()).localNode(), primaryKey)) - primaryKey++; - - while (!client().affinity(CACHE_NAME).isBackup(((IgniteKernal)primary()).localNode(), backupKey) - && backupKey < 100 + backupKeyStart) - backupKey++; - - return new IgnitePair<>(primaryKey, backupKey); - } - - /** - * Return primary node. - * - * @return Primary node. - */ - private Ignite primary() { - return ignite(0); - } - - /** - * Return first backup node. - * - * @return First backup node. - */ - private Ignite backup1() { - return ignite(1); - } - - /** - * Return second backup node. - * - * @return Second backup node. - */ - private Ignite backup2() { - return ignite(2); - } - - /** - * Return client node. - * - * @return Client node. - */ - private Ignite client() { - return ignite(3); - } -}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java index 8f0e20f..d609ec7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java @@ -25,6 +25,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 static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -46,6 +47,13 @@ public class CrossCacheLockTest extends GridCommonAbstractTest { private static final String CACHE2 = "cache2"; /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java index 346e9f9..2e64c52 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java @@ -53,6 +53,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.jetbrains.annotations.Nullable; @@ -92,7 +93,8 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest { assert cnt >= 1 : "At least one grid must be started"; - initStoreStrategy(); + if (!MvccFeatureChecker.forcedMvcc() || MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) + initStoreStrategy(); startGrids(cnt); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java index df3430f..c837e21 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java @@ -39,6 +39,7 @@ import org.apache.ignite.internal.util.typedef.PE; 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; @@ -52,6 +53,13 @@ public class GridCacheMarshallingNodeJoinSelfTest extends GridCommonAbstractTest private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java index 800f4ba..2027117 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java @@ -29,6 +29,7 @@ import org.apache.ignite.testframework.GridTestUtils; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheMode.PARTITIONED; +import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict; /** * Multinode update test. @@ -97,8 +98,20 @@ public abstract class GridCacheMultinodeUpdateAbstractSelfTest extends GridCache final IgniteCache<Integer, Integer> cache = grid(idx).cache(DEFAULT_CACHE_NAME); - for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++) - cache.invoke(key, new IncProcessor()); + for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++) { + boolean updated = false; + + while (!updated) { + try { + cache.invoke(key, new IncProcessor()); + + updated = true; + } + catch (Exception e) { + assertMvccWriteConflict(e); + } + } + } return null; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java index fbfb994..aa9f029 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.testframework.MvccFeatureChecker; /** * @@ -39,6 +40,9 @@ public class GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest extends GridCa /** {@inheritDoc} */ @Override public void testInvoke() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-809"); + if (!MvccFeatureChecker.forcedMvcc()) + fail("https://issues.apache.org/jira/browse/IGNITE-809"); + else + super.testInvoke(); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java index 4cdc7a4..c0738a3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -27,6 +28,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; */ public class GridCacheMultinodeUpdateNearEnabledSelfTest extends GridCacheMultinodeUpdateAbstractSelfTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); } @@ -38,6 +46,9 @@ public class GridCacheMultinodeUpdateNearEnabledSelfTest extends GridCacheMultin /** {@inheritDoc} */ @Override public void testInvoke() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-809"); + if (!MvccFeatureChecker.forcedMvcc()) + fail("https://issues.apache.org/jira/browse/IGNITE-809"); + else + super.testInvoke(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java index c63f242..124e284 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java @@ -42,6 +42,7 @@ import org.apache.ignite.marshaller.jdk.JdkMarshaller; 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 static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -66,6 +67,13 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract /** Test cache name. */ protected static final String CACHE_NAME = "cache_name"; + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + /** * @return Cache mode. */ @@ -123,7 +131,7 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract cc.setBackups(0); - cc.setAtomicityMode(CacheAtomicityMode.ATOMIC); + cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); return cc; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java index 0fd3fb9..ccecfb7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java @@ -33,6 +33,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.CacheMode.PARTITIONED; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; @@ -109,6 +110,30 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest { /** * @throws Exception If failed. */ + public void testVersionMvccTx() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + atomicityMode = TRANSACTIONAL_SNAPSHOT; + + checkVersion(); + } + + /** + * @throws Exception If failed. + */ + public void testVersionMvccTxNearEnabled() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-7187"); + + atomicityMode = TRANSACTIONAL_SNAPSHOT; + + near = true; + + checkVersion(); + } + + /** + * @throws Exception If failed. + */ public void testVersionAtomicPrimary() throws Exception { atomicityMode = ATOMIC; @@ -138,17 +163,19 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest { checkVersion(String.valueOf(i), null); // Update. } - if (atomicityMode == TRANSACTIONAL) { + if (atomicityMode != ATOMIC) { for (int i = 100; i < 200; i++) { checkVersion(String.valueOf(i), PESSIMISTIC); // Create. checkVersion(String.valueOf(i), PESSIMISTIC); // Update. } - for (int i = 200; i < 300; i++) { - checkVersion(String.valueOf(i), OPTIMISTIC); // Create. + if (atomicityMode != TRANSACTIONAL_SNAPSHOT) { + for (int i = 200; i < 300; i++) { + checkVersion(String.valueOf(i), OPTIMISTIC); // Create. - checkVersion(String.valueOf(i), OPTIMISTIC); // Update. + checkVersion(String.valueOf(i), OPTIMISTIC); // Update. + } } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java index 406e5af..cb4410a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughSingleNodeTest.java @@ -17,8 +17,11 @@ package org.apache.ignite.internal.processors.cache; +import org.apache.ignite.testframework.MvccFeatureChecker; + 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.CacheMode.LOCAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -28,6 +31,13 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED; */ public class IgniteCacheInvokeReadThroughSingleNodeTest extends IgniteCacheInvokeReadThroughAbstractTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected void startNodes() throws Exception { startGrid(0); } @@ -87,4 +97,40 @@ public class IgniteCacheInvokeReadThroughSingleNodeTest extends IgniteCacheInvok public void testInvokeReadThroughTxLocal() throws Exception { invokeReadThrough(cacheConfiguration(LOCAL, TRANSACTIONAL, 0, false)); } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTx() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false)); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTxNearCache() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true)); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTxReplicated() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false)); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTxLocal() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(LOCAL, TRANSACTIONAL_SNAPSHOT, 0, false)); + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java index 8fd3758..3866a18 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughTest.java @@ -17,8 +17,11 @@ package org.apache.ignite.internal.processors.cache; +import org.apache.ignite.testframework.MvccFeatureChecker; + 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.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; @@ -27,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED; */ public class IgniteCacheInvokeReadThroughTest extends IgniteCacheInvokeReadThroughAbstractTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected void startNodes() throws Exception { startGridsMultiThreaded(4); @@ -104,4 +114,49 @@ public class IgniteCacheInvokeReadThroughTest extends IgniteCacheInvokeReadThrou public void testInvokeReadThroughTxReplicated() throws Exception { invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL, 0, false)); } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTx0() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 0, false)); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTx1() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, false)); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTx2() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 2, false)); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTxNearCache() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(PARTITIONED, TRANSACTIONAL_SNAPSHOT, 1, true)); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeReadThroughMvccTxReplicated() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + invokeReadThrough(cacheConfiguration(REPLICATED, TRANSACTIONAL_SNAPSHOT, 0, false)); + } } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java index 423c4a1..834be7f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java @@ -39,6 +39,7 @@ import org.apache.ignite.lang.IgniteRunnable; 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; @@ -65,6 +66,13 @@ public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest protected boolean client; /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java index 2909f0a..27bf171 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxCopyOnReadDisabledTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -26,6 +27,12 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; */ public class IgniteCacheTxCopyOnReadDisabledTest extends IgniteCacheCopyOnReadDisabledAbstractTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java index 3439590..26dbb7e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalPeekModesTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.LOCAL; @@ -28,6 +29,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; */ public class IgniteCacheTxLocalPeekModesTest extends IgniteCachePeekModesAbstractTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected CacheAtomicityMode atomicityMode() { return TRANSACTIONAL; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java index b398726..a25fd90 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxLocalStoreValueTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.LOCAL; @@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; */ public class IgniteCacheTxLocalStoreValueTest extends IgniteCacheStoreValueAbstractTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected int gridCount() { return 1; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java index fc719fa..4dc2cf3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearEnabledStoreValueTest.java @@ -18,12 +18,20 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.testframework.MvccFeatureChecker; /** * */ public class IgniteCacheTxNearEnabledStoreValueTest extends IgniteCacheTxStoreValueTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected NearCacheConfiguration nearConfiguration() { return new NearCacheConfiguration(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java index aa4faaf..bd03983 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java @@ -17,11 +17,20 @@ package org.apache.ignite.internal.processors.cache; +import org.apache.ignite.testframework.MvccFeatureChecker; + /** * Tests peek modes with near tx cache. */ public class IgniteCacheTxNearPeekModesTest extends IgniteCacheTxPeekModesTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected boolean hasNearCache() { return true; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java index ea22f53..b43ab9a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPeekModesTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -43,10 +44,10 @@ public class IgniteCacheTxPeekModesTest extends IgniteCachePeekModesAbstractTest } /** {@inheritDoc} */ - @Override public void testLocalPeek() throws Exception { - // TODO: uncomment and re-open ticket if fails. -// fail("https://issues.apache.org/jira/browse/IGNITE-1824"); + @Override public void testLocalEntries() throws Exception { + if (MvccFeatureChecker.forcedMvcc()) + fail("https://issues.apache.org/jira/browse/IGNITE-10167"); - super.testLocalPeek(); + super.testLocalEntries(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java index f3f52eb..f137e52 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxStoreValueTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheMode; import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; @@ -29,6 +30,13 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED; */ public class IgniteCacheTxStoreValueTest extends IgniteCacheStoreValueAbstractTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.INTERCEPTOR); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected int gridCount() { return 4; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java index 11f5138..c6179fb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java @@ -79,12 +79,18 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** Tx cache name. */ private static final String TX_CACHE_NAME = "tx-cache"; + /** Mvcc tx cache name. */ + private static final String MVCC_TX_CACHE_NAME = "mvcc-tx-cache"; + /** Near atomic cache name. */ private static final String NEAR_ATOMIC_CACHE_NAME = "near-atomic-cache"; /** Near tx cache name. */ private static final String NEAR_TX_CACHE_NAME = "near-tx-cache"; + /** Near mvcc tx cache name. */ + private static final String NEAR_MVCC_TX_CACHE_NAME = "near-mvcc-tx-cache"; + /** Failed caches. */ private static final Set<String> FAILED_CACHES; @@ -95,6 +101,8 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT set.add(TX_CACHE_NAME); set.add(NEAR_ATOMIC_CACHE_NAME); set.add(NEAR_TX_CACHE_NAME); + set.add(MVCC_TX_CACHE_NAME); + set.add(NEAR_MVCC_TX_CACHE_NAME); FAILED_CACHES = Collections.unmodifiableSet(set); } @@ -122,7 +130,13 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT ccfg2.setName(TX_CACHE_NAME); ccfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); - cfg.setCacheConfiguration(ccfg1, ccfg2); + CacheConfiguration<Integer, String> ccfg3 = new CacheConfiguration<>(); + + ccfg3.setIndexedTypes(Integer.class, String.class); + ccfg3.setName(MVCC_TX_CACHE_NAME); + ccfg3.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + + cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3); } else { GridQueryProcessor.idxCls = FailedIndexing.class; @@ -150,6 +164,13 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT /** * @throws Exception If failed. */ + public void testMvccTransactionalCacheInitialization() throws Exception { + checkCacheInitialization(MVCC_TX_CACHE_NAME); + } + + /** + * @throws Exception If failed. + */ public void testAtomicNearCacheInitialization() throws Exception { checkCacheInitialization(NEAR_ATOMIC_CACHE_NAME); } @@ -162,6 +183,15 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT } /** + * @throws Exception If failed. + */ + public void testMvccTransactionalNearCacheInitialization() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-7187"); + + checkCacheInitialization(NEAR_MVCC_TX_CACHE_NAME); + } + + /** * @param cacheName Cache name. * @throws Exception If failed. */ @@ -199,12 +229,15 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT IgniteCache<Integer, String> cache; // Start cache with near enabled. - if (NEAR_ATOMIC_CACHE_NAME.equals(cacheName) || NEAR_TX_CACHE_NAME.equals(cacheName)) { + if (NEAR_ATOMIC_CACHE_NAME.equals(cacheName) || NEAR_TX_CACHE_NAME.equals(cacheName) || + NEAR_MVCC_TX_CACHE_NAME.equals(cacheName)) { CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<Integer, String>(cacheName) .setNearConfiguration(new NearCacheConfiguration<Integer, String>()); if (NEAR_TX_CACHE_NAME.equals(cacheName)) ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); + else if (NEAR_MVCC_TX_CACHE_NAME.equals(cacheName)) + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); cache = client.getOrCreateCache(ccfg); } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java index 53c1cb2..4d74172 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; @@ -60,6 +61,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest { ccfg.setRebalanceMode(SYNC); ccfg.setNodeFilter(new TestNodeFilter("A")); + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); if (attrVal != null) { Map<String, Object> attrs = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java index 87bc6b1..ce29c31 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartCoordinatorFailoverTest.java @@ -27,6 +27,7 @@ import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteDataStreamer; import org.apache.ignite.IgniteException; +import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.affinity.AffinityFunctionContext; import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction; import org.apache.ignite.cluster.ClusterNode; @@ -125,6 +126,8 @@ public class IgniteDynamicCacheStartCoordinatorFailoverTest extends GridCommonAb cfg.setName("test-coordinator-failover"); + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); + cfg.setAffinity(new BrokenAffinityFunction(false, getTestIgniteInstanceName(2))); GridTestUtils.runAsync(new Callable<Object>() { http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java index c3e3e88..a00fd24 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java @@ -45,6 +45,7 @@ import org.jetbrains.annotations.NotNull; 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.FULL_SYNC; /** @@ -400,7 +401,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst { CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); - ccfg.setName("cache-4"); + ccfg.setName("cache-6"); ccfg.setAtomicityMode(TRANSACTIONAL); ccfg.setBackups(1); ccfg.setWriteSynchronizationMode(FULL_SYNC); @@ -408,6 +409,39 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst res.add(ccfg); } + { + CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); + + ccfg.setName("cache-7"); + ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + ccfg.setBackups(0); + ccfg.setWriteSynchronizationMode(FULL_SYNC); + + res.add(ccfg); + } + + { + CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); + + ccfg.setName("cache-8"); + ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + ccfg.setBackups(1); + ccfg.setWriteSynchronizationMode(FULL_SYNC); + + res.add(ccfg); + } + + { + CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); + + ccfg.setName("cache-9"); + ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + ccfg.setBackups(1); + ccfg.setWriteSynchronizationMode(FULL_SYNC); + + res.add(ccfg); + } + return res; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java index 53de23f..b5b83ad 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java @@ -281,6 +281,13 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testStartStopCacheSimpleTransactionalMvcc() throws Exception { + checkStartStopCacheSimple(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + } + + /** + * @throws Exception If failed. + */ public void testStartStopCacheSimpleAtomic() throws Exception { checkStartStopCacheSimple(CacheAtomicityMode.ATOMIC); } @@ -295,6 +302,13 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testStartStopCachesSimpleTransactionalMvcc() throws Exception { + checkStartStopCachesSimple(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + } + + /** + * @throws Exception If failed. + */ public void testStartStopCachesSimpleAtomic() throws Exception { checkStartStopCachesSimple(CacheAtomicityMode.ATOMIC); } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java index ec6b82d..d366306 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheWithConfigStartSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache; +import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; @@ -63,6 +64,7 @@ public class IgniteDynamicCacheWithConfigStartSelfTest extends GridCommonAbstrac CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(CACHE_NAME); ccfg.setIndexedTypes(String.class, String.class); + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); return ccfg; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java index 0cb0856..69bf233 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java @@ -44,7 +44,10 @@ import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.Nullable; -import static org.apache.ignite.cache.CacheAtomicityMode.*; +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.CacheAtomicityMode.values; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME; @@ -394,8 +397,9 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes cfgs.addAll(cacheConfigurations(null, ATOMIC)); cfgs.addAll(cacheConfigurations(null, TRANSACTIONAL)); + cfgs.addAll(cacheConfigurations(null, TRANSACTIONAL_SNAPSHOT)); - assertEquals(6, cfgs.size()); + assertEquals(9, cfgs.size()); Collection<IgniteCache> caches = client.getOrCreateCaches(cfgs); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java index b037a7b..f4d3b25 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java @@ -30,6 +30,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; @@ -250,6 +251,8 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes if (atomicityMode() != TRANSACTIONAL) return; + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); + final Ignite ignite = grid(0); final String key = "key"; http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java index 46669ac..2f04870 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAffinityEarlyTest.java @@ -156,7 +156,7 @@ public class CacheAffinityEarlyTest extends GridCommonAbstractTest { CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setCacheMode(CacheMode.PARTITIONED); - ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setBackups(1); ccfg.setNearConfiguration(null); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java index 8859638..af223f4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGroupsPreloadTest.java @@ -106,6 +106,17 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testCachePreloadMvcc2() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-7187"); + + atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; + + cachePreloadTest(); + } + + /** + * @throws Exception If failed. + */ public void testCachePreload3() throws Exception { cacheMode = CacheMode.REPLICATED; @@ -125,6 +136,16 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testCachePreloadMvcc4() throws Exception { + cacheMode = CacheMode.REPLICATED; + atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; + + cachePreloadTest(); + } + + /** + * @throws Exception If failed. + */ public void testCachePreload5() throws Exception { sameGrp = false; @@ -144,6 +165,18 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testCachePreloadMvcc6() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-7187"); + + sameGrp = false; + atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; + + cachePreloadTest(); + } + + /** + * @throws Exception If failed. + */ public void testCachePreload7() throws Exception { sameGrp = false; cacheMode = CacheMode.REPLICATED; @@ -165,6 +198,17 @@ public class CacheGroupsPreloadTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testCachePreloadMvcc8() throws Exception { + sameGrp = false; + cacheMode = CacheMode.REPLICATED; + atomicityMode = CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; + + cachePreloadTest(); + } + + /** + * @throws Exception If failed. + */ private void cachePreloadTest() throws Exception { IgniteCache<Object, Object> cache = startGrid(0).cache(CACHE1); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java index d59f470..54889e4 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheStartOnJoinTest.java @@ -46,6 +46,7 @@ import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; +import static org.apache.ignite.testframework.MvccFeatureChecker.assertMvccWriteConflict; /** * @@ -184,7 +185,18 @@ public class CacheStartOnJoinTest extends GridCommonAbstractTest { if (createCache) { for (int c = 0; c < 5; c++) { for (IgniteCache cache : node.getOrCreateCaches(cacheConfigurations())) { - cache.put(c, c); + boolean updated = false; + + while (!updated) { + try { + cache.put(c, c); + + updated = true; + } + catch (Exception e) { + assertMvccWriteConflict(e); + } + } assertEquals(c, cache.get(c)); } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java index 23fc941..0b021a8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutMultiNodeSelfTest.java @@ -34,6 +34,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; /** @@ -94,8 +95,18 @@ public class IgniteCacheCreatePutMultiNodeSelfTest extends GridCommonAbstractTes IgniteCache<Integer, Integer> cache = getCache(ignite, cacheName); - for (int i = 0; i < 100; i++) - cache.getAndPut(i, i); + for (int i = 0; i < 100; i++) { + while (true) { + try { + cache.getAndPut(i, i); + + break; + } + catch (Exception e) { + MvccFeatureChecker.assertMvccWriteConflict(e); + } + } + } barrier.await(); @@ -139,7 +150,7 @@ public class IgniteCacheCreatePutMultiNodeSelfTest extends GridCommonAbstractTes CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(cacheName); ccfg.setCacheMode(CacheMode.PARTITIONED); - ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); + ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setBackups(1); ccfg.setNearConfiguration(null); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java index 646084c..5d6e895 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java @@ -37,9 +37,11 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; 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.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.MvccFeatureChecker.assertMvccWriteConflict; /** * @@ -149,6 +151,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest { ignite0.createCache(cacheConfiguration("atomic-cache", ATOMIC)); ignite0.createCache(cacheConfiguration("tx-cache", TRANSACTIONAL)); + ignite0.createCache(cacheConfiguration("mvcc-tx-cache", TRANSACTIONAL_SNAPSHOT)); final long stopTime = System.currentTimeMillis() + 60_000; @@ -162,6 +165,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest { IgniteCache cache1 = node.cache("atomic-cache"); IgniteCache cache2 = node.cache("tx-cache"); + IgniteCache cache3 = node.cache("mvcc-tx-cache"); ThreadLocalRandom rnd = ThreadLocalRandom.current(); @@ -174,6 +178,13 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest { cache2.put(key, key); + try { + cache3.put(key, key); + } + catch (Exception e) { + assertMvccWriteConflict(e); // Do not retry. + } + if (iter++ % 1000 == 0) log.info("Update iteration: " + iter); } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java index 3eca6b3..7414b88 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheFailedUpdateResponseTest.java @@ -40,11 +40,13 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.failure.FailureHandler; import org.apache.ignite.failure.NoOpFailureHandler; import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.processors.cache.IgniteCacheProxy; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; +import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT; import static org.apache.ignite.testframework.GridTestUtils.assertThrows; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; @@ -53,7 +55,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; /** - * Checks that no future hangs on non-srializable exceptions and values. + * Checks that no future hangs on non-serializable exceptions and values. */ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest { /** Atomic cache. */ @@ -62,25 +64,34 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest /** Tx cache. */ private static final String TX_CACHE = "tx"; + /** Mvcc tx cache. */ + private static final String MVCC_TX_CACHE = "mvcc-tx"; + /** Atomic cache. */ private IgniteCache<Object, Object> atomicCache; /** Tx cache. */ private IgniteCache<Object, Object> txCache; + /** Mvcc tx cache. */ + private IgniteCache<Object, Object> mvccTxCache; + /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration atomicCfg = new CacheConfiguration(ATOMIC_CACHE); CacheConfiguration txCfg = new CacheConfiguration(TX_CACHE); + CacheConfiguration mvccTxCfg = new CacheConfiguration(MVCC_TX_CACHE); atomicCfg.setBackups(1); txCfg.setBackups(1); + mvccTxCfg.setBackups(1); txCfg.setAtomicityMode(TRANSACTIONAL); + mvccTxCfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); - cfg.setCacheConfiguration(atomicCfg, txCfg); + cfg.setCacheConfiguration(atomicCfg, txCfg, mvccTxCfg); cfg.setClientMode(igniteInstanceName.contains("client")); @@ -100,6 +111,7 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest @Override protected void beforeTest() throws Exception { atomicCache = grid("client").cache(ATOMIC_CACHE); txCache = grid("client").cache(TX_CACHE); + mvccTxCache = grid("client").cache(MVCC_TX_CACHE); } /** {@inheritDoc} */ @@ -142,10 +154,31 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest } /** + * @throws Exception If failed. + */ + public void testInvokeMvccTx() throws Exception { + testInvoke(mvccTxCache); + testInvokeAll(mvccTxCache); + + IgniteEx client = grid("client"); + + Callable<Object> clos = new Callable<Object>() { + @Override public Object call() throws Exception { + testInvoke(mvccTxCache); + testInvokeAll(mvccTxCache); + + return null; + } + }; + + doInTransaction(client, PESSIMISTIC, REPEATABLE_READ, clos); + } + + /** * @param cache Cache. */ private void testInvoke(final IgniteCache<Object, Object> cache) throws Exception { - Class<? extends Exception> exp = grid("client").transactions().tx() == null + Class<? extends Exception> exp = grid("client").transactions().tx() == null || ((IgniteCacheProxy)cache).context().mvccEnabled() ? EntryProcessorException.class : NonSerializableException.class; @@ -181,7 +214,7 @@ public class IgniteCacheFailedUpdateResponseTest extends GridCommonAbstractTest assertNotNull(epRes); // In transactions EP will be invoked locally. - Class<? extends Exception> exp = grid("client").transactions().tx() == null + Class<? extends Exception> exp = grid("client").transactions().tx() == null || ((IgniteCacheProxy)cache).context().mvccEnabled() ? EntryProcessorException.class : NonSerializableException.class;