IGNITE-10049: MVCC: Create "Cache 4" test suite for MVCC mode. This closes #5499.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cf32fc7b Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cf32fc7b Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cf32fc7b Branch: refs/heads/master Commit: cf32fc7baccea641f11a691f4897d564387b7fc8 Parents: ee5a8f3 Author: rkondakov <kondako...@mail.ru> Authored: Wed Dec 5 15:54:44 2018 +0300 Committer: Igor Seliverstov <gvvinbl...@gmail.com> Committed: Wed Dec 5 15:54:44 2018 +0300 ---------------------------------------------------------------------- ...RWThroughDisabledTransactionalCacheTest.java | 8 + ...heStoreSessionListenerLifecycleSelfTest.java | 8 + ...reSessionListenerWriteBehindEnabledTest.java | 8 + .../CacheJdbcStoreSessionListenerSelfTest.java | 8 + .../GridCacheTxLoadFromStoreOnLockSelfTest.java | 8 + .../cache/CacheClientStoreSelfTest.java | 8 + .../cache/CacheConnectionLeakStoreTxTest.java | 20 + .../cache/CacheEventWithTxLabelTest.java | 494 +++++++++++++++++++ .../cache/CacheGetEntryAbstractTest.java | 4 +- ...GetEntryOptimisticReadCommittedSelfTest.java | 36 ++ ...GetEntryOptimisticReadCommittedSeltTest.java | 36 -- ...etEntryOptimisticRepeatableReadSelfTest.java | 36 ++ ...etEntryOptimisticRepeatableReadSeltTest.java | 36 -- ...eGetEntryOptimisticSerializableSelfTest.java | 36 ++ ...eGetEntryOptimisticSerializableSeltTest.java | 36 -- ...etEntryPessimisticReadCommittedSelfTest.java | 36 ++ ...etEntryPessimisticReadCommittedSeltTest.java | 36 -- ...tEntryPessimisticRepeatableReadSelfTest.java | 105 ++++ ...tEntryPessimisticRepeatableReadSeltTest.java | 40 -- ...GetEntryPessimisticSerializableSelfTest.java | 36 ++ ...GetEntryPessimisticSerializableSeltTest.java | 36 -- .../cache/CacheOffheapMapEntrySelfTest.java | 14 + .../CacheReadThroughLocalRestartSelfTest.java | 8 + .../cache/CacheReadThroughRestartSelfTest.java | 11 + .../cache/CacheRemoveAllSelfTest.java | 9 + .../cache/CacheStopAndDestroySelfTest.java | 18 + ...heStoreUsageMultinodeDynamicStartTxTest.java | 8 + ...cheStoreUsageMultinodeStaticStartTxTest.java | 8 + .../CacheTxNotAllowReadFromBackupTest.java | 66 +++ .../cache/CashEventWithTxLabelTest.java | 487 ------------------ .../processors/cache/CrossCacheLockTest.java | 8 + .../cache/GridCacheAbstractSelfTest.java | 4 +- .../GridCacheMarshallingNodeJoinSelfTest.java | 8 + ...ridCacheMultinodeUpdateAbstractSelfTest.java | 17 +- ...inodeUpdateNearEnabledNoBackupsSelfTest.java | 6 +- ...CacheMultinodeUpdateNearEnabledSelfTest.java | 13 +- ...ridCacheStoreManagerDeserializationTest.java | 10 +- .../cache/GridCacheVersionMultinodeTest.java | 35 +- ...iteCacheInvokeReadThroughSingleNodeTest.java | 46 ++ .../cache/IgniteCacheInvokeReadThroughTest.java | 55 +++ .../IgniteCacheReadThroughStoreCallTest.java | 8 + .../IgniteCacheTxCopyOnReadDisabledTest.java | 7 + .../cache/IgniteCacheTxLocalPeekModesTest.java | 8 + .../cache/IgniteCacheTxLocalStoreValueTest.java | 8 + .../IgniteCacheTxNearEnabledStoreValueTest.java | 8 + .../cache/IgniteCacheTxNearPeekModesTest.java | 9 + .../cache/IgniteCacheTxPeekModesTest.java | 9 +- .../cache/IgniteCacheTxStoreValueTest.java | 8 + ...IgniteClientCacheInitializationFailTest.java | 37 +- .../cache/IgniteDynamicCacheFilterTest.java | 2 + ...ynamicCacheStartCoordinatorFailoverTest.java | 3 + ...eDynamicCacheStartNoExchangeTimeoutTest.java | 36 +- .../cache/IgniteDynamicCacheStartSelfTest.java | 14 + ...niteDynamicCacheWithConfigStartSelfTest.java | 2 + .../IgniteDynamicClientCacheStartSelfTest.java | 8 +- .../IgniteStartCacheInTransactionSelfTest.java | 3 + .../distributed/CacheAffinityEarlyTest.java | 2 +- .../distributed/CacheGroupsPreloadTest.java | 44 ++ .../cache/distributed/CacheStartOnJoinTest.java | 14 +- .../IgniteCacheCreatePutMultiNodeSelfTest.java | 17 +- .../distributed/IgniteCacheCreatePutTest.java | 11 + .../IgniteCacheFailedUpdateResponseTest.java | 41 +- .../IgniteCacheReadFromBackupTest.java | 89 +++- .../IgniteCacheSingleGetMessageTest.java | 33 +- .../IgniteTxPreloadAbstractTest.java | 10 +- .../dht/IgniteCacheLockFailoverSelfTest.java | 8 + .../dht/IgniteCacheMultiTxLockSelfTest.java | 24 +- .../dht/IgniteCrossCacheMvccTxSelfTest.java | 39 ++ .../dht/IgniteCrossCacheTxAbstractSelfTest.java | 181 +++++++ .../dht/IgniteCrossCacheTxSelfTest.java | 155 +----- .../near/GridCacheNearTxPreloadSelfTest.java | 8 + .../near/GridCachePartitionedEventSelfTest.java | 8 + .../near/IgniteCacheNearOnlyTxTest.java | 8 + .../near/IgniteCacheNearReadCommittedTest.java | 8 + .../IgniteCacheLoadAllAbstractTest.java | 10 +- .../IgniteCacheTxLoaderWriterTest.java | 8 + .../IgniteCacheTxLocalLoadAllTest.java | 7 + ...niteCacheTxLocalNoLoadPreviousValueTest.java | 8 + .../IgniteCacheTxLocalNoReadThroughTest.java | 8 + .../IgniteCacheTxLocalNoWriteThroughTest.java | 8 + ...cheTxNearEnabledNoLoadPreviousValueTest.java | 8 + ...iteCacheTxNearEnabledNoWriteThroughTest.java | 8 + .../IgniteCacheTxNoLoadPreviousValueTest.java | 8 + .../IgniteCacheTxNoReadThroughTest.java | 8 + .../IgniteCacheTxNoWriteThroughTest.java | 8 + .../IgniteCacheTxStoreSessionTest.java | 8 + ...TxStoreSessionWriteBehindCoalescingTest.java | 8 + ...gniteCacheTxStoreSessionWriteBehindTest.java | 8 + ...ersionedEntryLocalTransactionalSelfTest.java | 9 + .../testframework/MvccFeatureChecker.java | 20 + .../testsuites/IgniteCacheMvccTestSuite2.java | 1 + .../testsuites/IgniteCacheMvccTestSuite4.java | 197 ++++++++ .../testsuites/IgniteCacheTestSuite4.java | 356 ++++++------- 93 files changed, 2396 insertions(+), 1072 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java index 4503815..faf30b7 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreListenerRWThroughDisabledTransactionalCacheTest.java @@ -20,6 +20,7 @@ package org.apache.ignite.cache.store; import java.util.Random; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.testframework.MvccFeatureChecker; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; @@ -37,6 +38,13 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE; */ public class CacheStoreListenerRWThroughDisabledTransactionalCacheTest extends CacheStoreSessionListenerReadWriteThroughDisabledAbstractTest { /** {@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/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java index ff176c5..9bc3cdc 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerLifecycleSelfTest.java @@ -34,6 +34,7 @@ import org.apache.ignite.resources.IgniteInstanceResource; 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; @@ -50,6 +51,13 @@ public class CacheStoreSessionListenerLifecycleSelfTest extends GridCommonAbstra private static final Queue<String> evts = new ConcurrentLinkedDeque<>(); /** {@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/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java index 9314dbb..3ba4ec2 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerWriteBehindEnabledTest.java @@ -44,6 +44,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest; import org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore; import org.apache.ignite.resources.CacheStoreSessionResource; import org.apache.ignite.testframework.GridTestUtils; +import org.apache.ignite.testframework.MvccFeatureChecker; /** * This class tests that calls of {@link CacheStoreSessionListener#onSessionStart(CacheStoreSession)} @@ -67,6 +68,13 @@ public class CacheStoreSessionListenerWriteBehindEnabledTest extends GridCacheAb private static final AtomicInteger uninitializedListenerCnt = new AtomicInteger(); /** {@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/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java index 237cfeb..968dc08 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java @@ -32,6 +32,7 @@ import org.apache.ignite.cache.store.CacheStoreSessionListener; import org.apache.ignite.cache.store.CacheStoreSessionListenerAbstractSelfTest; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.resources.CacheStoreSessionResource; +import org.apache.ignite.testframework.MvccFeatureChecker; import org.h2.jdbcx.JdbcConnectionPool; /** @@ -39,6 +40,13 @@ import org.h2.jdbcx.JdbcConnectionPool; */ public class CacheJdbcStoreSessionListenerSelfTest extends CacheStoreSessionListenerAbstractSelfTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected Factory<? extends CacheStore<Integer, Integer>> storeFactory() { return new Factory<CacheStore<Integer, Integer>>() { @Override public CacheStore<Integer, Integer> create() { http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java index 6293723..a1f18a7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java @@ -33,6 +33,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; @@ -46,6 +47,13 @@ public class GridCacheTxLoadFromStoreOnLockSelfTest extends GridCommonAbstractTe 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/CacheClientStoreSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java index 8703791..ecf9d2e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java @@ -40,6 +40,7 @@ import org.apache.ignite.resources.IgniteInstanceResource; 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.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK; @@ -67,6 +68,13 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest { private static volatile boolean loadedFromClient; /** {@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/CacheConnectionLeakStoreTxTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java index 27dbe62..db08d53 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConnectionLeakStoreTxTest.java @@ -170,6 +170,26 @@ public class CacheConnectionLeakStoreTxTest extends GridCommonAbstractTest { } /** + * @throws Exception If failed. + */ + public void testConnectionLeakOneBackupMvccPessimisticRepeatableRead() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + checkConnectionLeak(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, PESSIMISTIC, REPEATABLE_READ); + } + + /** + * @throws Exception If failed. + */ + public void testConnectionLeakOneBackupMvccPessimisticRepeatableReadLoadFromStore() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-8582"); + + isLoadFromStore = true; + + checkConnectionLeak(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, PESSIMISTIC, REPEATABLE_READ); + } + + /** * @param atomicityMode Atomicity mode. * @param txConcurrency Transaction concurrency. * @param txIsolation Transaction isolation. http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java new file mode 100644 index 0000000..dabf0db --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEventWithTxLabelTest.java @@ -0,0 +1,494 @@ +/* + * 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.MvccFeatureChecker; +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 CacheEventWithTxLabelTest 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 { + if (MvccFeatureChecker.forcedMvcc()) + fail("https://issues.apache.org/jira/browse/IGNITE-10270"); + + 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; + + if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(concurrency, isolation)) + continue; + + 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/CacheGetEntryAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java index f347525..3e7b791 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java @@ -170,8 +170,6 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes * @throws Exception If failed. */ public void testLocalTransactional() throws Exception { - // TODO: fails since d13520e9a05bd9e9b987529472d6317951b72f96, need to review changes. - CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); cfg.setWriteSynchronizationMode(FULL_SYNC); @@ -214,7 +212,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes * @param cfg Cache configuration. * @throws Exception If failed. */ - private void test(CacheConfiguration cfg) throws Exception { + protected void test(CacheConfiguration cfg) throws Exception { test(cfg, true); test(cfg, false); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java new file mode 100644 index 0000000..0927546 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSelfTest.java @@ -0,0 +1,36 @@ +/* + * 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 org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; + +/** + * Test getEntry and getEntries methods. + */ +public class CacheGetEntryOptimisticReadCommittedSelfTest extends CacheGetEntryAbstractTest { + /** {@inheritDoc} */ + @Override protected TransactionConcurrency concurrency() { + return TransactionConcurrency.OPTIMISTIC; + } + + /** {@inheritDoc} */ + @Override protected TransactionIsolation isolation() { + return TransactionIsolation.READ_COMMITTED; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java deleted file mode 100644 index c04612d..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticReadCommittedSeltTest.java +++ /dev/null @@ -1,36 +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 org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; - -/** - * Test getEntry and getEntries methods. - */ -public class CacheGetEntryOptimisticReadCommittedSeltTest extends CacheGetEntryAbstractTest { - /** {@inheritDoc} */ - @Override protected TransactionConcurrency concurrency() { - return TransactionConcurrency.OPTIMISTIC; - } - - /** {@inheritDoc} */ - @Override protected TransactionIsolation isolation() { - return TransactionIsolation.READ_COMMITTED; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java new file mode 100644 index 0000000..2c6a204 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSelfTest.java @@ -0,0 +1,36 @@ +/* + * 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 org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; + +/** + * Test getEntry and getEntries methods. + */ +public class CacheGetEntryOptimisticRepeatableReadSelfTest extends CacheGetEntryAbstractTest { + /** {@inheritDoc} */ + @Override protected TransactionConcurrency concurrency() { + return TransactionConcurrency.OPTIMISTIC; + } + + /** {@inheritDoc} */ + @Override protected TransactionIsolation isolation() { + return TransactionIsolation.REPEATABLE_READ; + } +} \ 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/CacheGetEntryOptimisticRepeatableReadSeltTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSeltTest.java deleted file mode 100644 index 6153869..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticRepeatableReadSeltTest.java +++ /dev/null @@ -1,36 +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 org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; - -/** - * Test getEntry and getEntries methods. - */ -public class CacheGetEntryOptimisticRepeatableReadSeltTest extends CacheGetEntryAbstractTest { - /** {@inheritDoc} */ - @Override protected TransactionConcurrency concurrency() { - return TransactionConcurrency.OPTIMISTIC; - } - - /** {@inheritDoc} */ - @Override protected TransactionIsolation isolation() { - return TransactionIsolation.REPEATABLE_READ; - } -} \ 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/CacheGetEntryOptimisticSerializableSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSelfTest.java new file mode 100644 index 0000000..63161e2 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSelfTest.java @@ -0,0 +1,36 @@ +/* + * 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 org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; + +/** + * Test getEntry and getEntries methods. + */ +public class CacheGetEntryOptimisticSerializableSelfTest extends CacheGetEntryAbstractTest { + /** {@inheritDoc} */ + @Override protected TransactionConcurrency concurrency() { + return TransactionConcurrency.OPTIMISTIC; + } + + /** {@inheritDoc} */ + @Override protected TransactionIsolation isolation() { + return TransactionIsolation.SERIALIZABLE; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java deleted file mode 100644 index 6ded4a9..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryOptimisticSerializableSeltTest.java +++ /dev/null @@ -1,36 +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 org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; - -/** - * Test getEntry and getEntries methods. - */ -public class CacheGetEntryOptimisticSerializableSeltTest extends CacheGetEntryAbstractTest { - /** {@inheritDoc} */ - @Override protected TransactionConcurrency concurrency() { - return TransactionConcurrency.OPTIMISTIC; - } - - /** {@inheritDoc} */ - @Override protected TransactionIsolation isolation() { - return TransactionIsolation.SERIALIZABLE; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java new file mode 100644 index 0000000..0a291f7 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSelfTest.java @@ -0,0 +1,36 @@ +/* + * 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 org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; + +/** + * Test getEntry and getEntries methods. + */ +public class CacheGetEntryPessimisticReadCommittedSelfTest extends CacheGetEntryAbstractTest { + /** {@inheritDoc} */ + @Override protected TransactionConcurrency concurrency() { + return TransactionConcurrency.PESSIMISTIC; + } + + /** {@inheritDoc} */ + @Override protected TransactionIsolation isolation() { + return TransactionIsolation.READ_COMMITTED; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java deleted file mode 100644 index 975d271..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticReadCommittedSeltTest.java +++ /dev/null @@ -1,36 +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 org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; - -/** - * Test getEntry and getEntries methods. - */ -public class CacheGetEntryPessimisticReadCommittedSeltTest extends CacheGetEntryAbstractTest { - /** {@inheritDoc} */ - @Override protected TransactionConcurrency concurrency() { - return TransactionConcurrency.PESSIMISTIC; - } - - /** {@inheritDoc} */ - @Override protected TransactionIsolation isolation() { - return TransactionIsolation.READ_COMMITTED; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java new file mode 100644 index 0000000..906b726 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSelfTest.java @@ -0,0 +1,105 @@ +/* + * 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 org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.NearCacheConfiguration; +import org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; + +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; +import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; + +/** + * Test getEntry and getEntries methods. + */ +public class CacheGetEntryPessimisticRepeatableReadSelfTest extends CacheGetEntryAbstractTest { + /** {@inheritDoc} */ + @Override protected TransactionConcurrency concurrency() { + return TransactionConcurrency.PESSIMISTIC; + } + + /** {@inheritDoc} */ + @Override protected TransactionIsolation isolation() { + return TransactionIsolation.REPEATABLE_READ; + } + + /** + * @throws Exception If failed. + */ + public void testNearTransactionalMvcc() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-7187"); + + CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); + + cfg.setWriteSynchronizationMode(FULL_SYNC); + cfg.setCacheMode(PARTITIONED); + cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + cfg.setName("nearT"); + cfg.setNearConfiguration(new NearCacheConfiguration()); + + test(cfg); + } + + /** + * @throws Exception If failed. + */ + public void testPartitionedTransactionalMvcc() throws Exception { + CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); + + cfg.setWriteSynchronizationMode(FULL_SYNC); + cfg.setCacheMode(PARTITIONED); + cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + cfg.setName("partitionedT"); + + test(cfg); + } + + /** + * @throws Exception If failed. + */ + public void testLocalTransactionalMvcc() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-9530"); + + CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); + + cfg.setWriteSynchronizationMode(FULL_SYNC); + cfg.setCacheMode(LOCAL); + cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + cfg.setName("localT"); + + test(cfg); + } + + /** + * @throws Exception If failed. + */ + public void testReplicatedTransactionalMvcc() throws Exception { + CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); + + cfg.setWriteSynchronizationMode(FULL_SYNC); + cfg.setCacheMode(REPLICATED); + cfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); + cfg.setName("replicatedT"); + + test(cfg); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java deleted file mode 100644 index 4aa693c..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticRepeatableReadSeltTest.java +++ /dev/null @@ -1,40 +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 org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; - -/** - * Test getEntry and getEntries methods. - */ -public class CacheGetEntryPessimisticRepeatableReadSeltTest extends CacheGetEntryAbstractTest { - /** {@inheritDoc} */ - @Override protected TransactionConcurrency concurrency() { - return TransactionConcurrency.PESSIMISTIC; - } - - /** {@inheritDoc} */ - @Override protected TransactionIsolation isolation() { - return TransactionIsolation.REPEATABLE_READ; - } - - @Override public void testReplicatedTransactional() throws Exception { - super.testReplicatedTransactional(); - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java new file mode 100644 index 0000000..dfaed7e --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSelfTest.java @@ -0,0 +1,36 @@ +/* + * 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 org.apache.ignite.transactions.TransactionConcurrency; +import org.apache.ignite.transactions.TransactionIsolation; + +/** + * Test getEntry and getEntries methods. + */ +public class CacheGetEntryPessimisticSerializableSelfTest extends CacheGetEntryAbstractTest { + /** {@inheritDoc} */ + @Override protected TransactionConcurrency concurrency() { + return TransactionConcurrency.PESSIMISTIC; + } + + /** {@inheritDoc} */ + @Override protected TransactionIsolation isolation() { + return TransactionIsolation.SERIALIZABLE; + } +} \ 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/CacheGetEntryPessimisticSerializableSeltTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSeltTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSeltTest.java deleted file mode 100644 index 70f71ce..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryPessimisticSerializableSeltTest.java +++ /dev/null @@ -1,36 +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 org.apache.ignite.transactions.TransactionConcurrency; -import org.apache.ignite.transactions.TransactionIsolation; - -/** - * Test getEntry and getEntries methods. - */ -public class CacheGetEntryPessimisticSerializableSeltTest extends CacheGetEntryAbstractTest { - /** {@inheritDoc} */ - @Override protected TransactionConcurrency concurrency() { - return TransactionConcurrency.PESSIMISTIC; - } - - /** {@inheritDoc} */ - @Override protected TransactionIsolation isolation() { - return TransactionIsolation.SERIALIZABLE; - } -} \ 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/CacheOffheapMapEntrySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java index e520d45..f2e12ad 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java @@ -25,9 +25,11 @@ import org.apache.ignite.internal.IgniteKernal; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry; import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry; import org.apache.ignite.internal.processors.cache.local.GridLocalCacheEntry; +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; @@ -76,6 +78,9 @@ public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest { cfg.setAtomicityMode(atomicityMode); cfg.setName(cacheName); + if (atomicityMode == TRANSACTIONAL_SNAPSHOT && !MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.NEAR_CACHE)) + cfg.setNearConfiguration(null); + return cfg; } @@ -87,13 +92,22 @@ public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest { checkCacheMapEntry(TRANSACTIONAL, LOCAL, GridLocalCacheEntry.class); + if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.LOCAL_CACHE)) + checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, LOCAL, GridLocalCacheEntry.class); + checkCacheMapEntry(ATOMIC, PARTITIONED, GridNearCacheEntry.class); checkCacheMapEntry(TRANSACTIONAL, PARTITIONED, GridNearCacheEntry.class); + if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) + checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, PARTITIONED, GridDhtCacheEntry.class); + checkCacheMapEntry(ATOMIC, REPLICATED, GridDhtCacheEntry.class); checkCacheMapEntry(TRANSACTIONAL, REPLICATED, GridDhtCacheEntry.class); + + if (MvccFeatureChecker.isSupported(MvccFeatureChecker.Feature.CACHE_STORE)) + checkCacheMapEntry(TRANSACTIONAL_SNAPSHOT, REPLICATED, GridDhtCacheEntry.class); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java index 58fa8d6..5e8b1eb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughLocalRestartSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.testframework.MvccFeatureChecker; import static org.apache.ignite.cache.CacheMode.LOCAL; @@ -29,4 +30,11 @@ public class CacheReadThroughLocalRestartSelfTest extends CacheReadThroughRestar @Override protected CacheMode cacheMode() { return LOCAL; } + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE); + + super.setUp(); + } } \ 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/CacheReadThroughRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java index 422ed58..5b79f7f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java @@ -27,6 +27,7 @@ import org.apache.ignite.configuration.TransactionConfiguration; 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.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; @@ -42,6 +43,13 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest { 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 int gridCount() { return 2; } @@ -116,6 +124,9 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest { for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) { for (TransactionIsolation txIsolation : TransactionIsolation.values()) { + if (MvccFeatureChecker.forcedMvcc() && !MvccFeatureChecker.isSupported(txConcurrency, txIsolation)) + continue; + try (Transaction tx = ignite.transactions().txStart(txConcurrency, txIsolation, 100000, 1000)) { for (int k = 0; k < 1000; k++) { String key = "key" + k; http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java index a27bdda..cccb92a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java @@ -24,12 +24,21 @@ import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; +import org.apache.ignite.testframework.MvccFeatureChecker; /** * Test remove all method. */ public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest { /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + if (MvccFeatureChecker.forcedMvcc()) + fail("https://issues.apache.org/jira/browse/IGNITE-10082"); + + super.setUp(); + } + + /** {@inheritDoc} */ @Override protected long getTestTimeout() { return 2 * 60 * 1000; } http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java index 6239b52..a204ddf 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStopAndDestroySelfTest.java @@ -29,6 +29,7 @@ import javax.cache.configuration.MutableConfiguration; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteException; +import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; @@ -47,6 +48,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 static org.apache.ignite.cache.CacheMode.LOCAL; @@ -150,6 +152,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { cfg.setName(CACHE_NAME_DHT); cfg.setCacheMode(PARTITIONED); + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cfg.setNearConfiguration(null); return cfg; @@ -163,6 +166,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { cfg.setName(CACHE_NAME_CLIENT); cfg.setCacheMode(PARTITIONED); + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cfg.setNearConfiguration(null); return cfg; @@ -176,6 +180,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { cfg.setName(CACHE_NAME_NEAR); cfg.setCacheMode(PARTITIONED); + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cfg.setNearConfiguration(new NearCacheConfiguration()); return cfg; @@ -190,6 +195,7 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { cfg.setName(CACHE_NAME_LOC); cfg.setCacheMode(LOCAL); cfg.setNearConfiguration(null); + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); return cfg; } @@ -280,6 +286,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testNearDoubleDestroy() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); + startGridsMultiThreaded(gridCount()); nearDestroy(); @@ -320,6 +328,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testLocalDoubleDestroy() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE); + startGridsMultiThreaded(gridCount()); localDestroy(); @@ -563,6 +573,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testNearClose() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); + startGridsMultiThreaded(gridCount()); IgniteCache<String, String> cache0 = grid(0).getOrCreateCache(getNearConfig()); @@ -636,6 +648,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testNearCloseWithTry() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.NEAR_CACHE); + startGridsMultiThreaded(gridCount()); String curVal = null; @@ -674,6 +688,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testLocalClose() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE); + memCfg = new DataStorageConfiguration(); startGridsMultiThreaded(gridCount()); @@ -725,6 +741,8 @@ public class CacheStopAndDestroySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ public void testLocalCloseWithTry() throws Exception { + MvccFeatureChecker.failIfNotSupported(MvccFeatureChecker.Feature.LOCAL_CACHE); + memCfg = new DataStorageConfiguration(); startGridsMultiThreaded(gridCount()); http://git-wip-us.apache.org/repos/asf/ignite/blob/cf32fc7b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java index 4511fc5..e217a1f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartTxTest.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,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; */ public class CacheStoreUsageMultinodeDynamicStartTxTest extends CacheStoreUsageMultinodeDynamicStartAbstractTest { /** {@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/CacheStoreUsageMultinodeStaticStartTxTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java index 2f11fc8..8fa7e65 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeStaticStartTxTest.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,13 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; */ public class CacheStoreUsageMultinodeStaticStartTxTest extends CacheStoreUsageMultinodeStaticStartAbstractTest { /** {@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/CacheTxNotAllowReadFromBackupTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java index f0ec084..fad2c61 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxNotAllowReadFromBackupTest.java @@ -189,6 +189,72 @@ public class CacheTxNotAllowReadFromBackupTest extends GridCommonAbstractTest { } /** + * @throws Exception If failed. + */ + public void testBackupConsistencyReplicatedMvcc() throws Exception { + CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache"); + + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC); + cfg.setCacheMode(CacheMode.REPLICATED); + cfg.setReadFromBackup(false); + + checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + + checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + } + + /** + * @throws Exception If failed. + */ + public void testBackupConsistencyReplicatedFullSyncMvcc() throws Exception { + CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache"); + + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); + cfg.setCacheMode(CacheMode.REPLICATED); + cfg.setReadFromBackup(false); + + checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + + checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + } + + /** + * @throws Exception If failed. + */ + public void testBackupConsistencyPartitionedMvcc() throws Exception { + CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache"); + + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC); + cfg.setCacheMode(CacheMode.PARTITIONED); + cfg.setBackups(NODES - 1); + cfg.setReadFromBackup(false); + + checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + + checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + } + + /** + * @throws Exception If failed. + */ + public void testBackupConsistencyPartitionedFullSyncMvcc() throws Exception { + CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache"); + + cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); + cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); + cfg.setCacheMode(CacheMode.PARTITIONED); + cfg.setBackups(NODES - 1); + cfg.setReadFromBackup(false); + + checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + + checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); + } + + /** * @param ccfg Cache configuration. * @throws Exception If failed. */