Repository: ignite Updated Branches: refs/heads/ignite-971 fcfc37908 -> 2ca3d7205
ignite-971 Fix offheap to swap eviction. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2ca3d720 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2ca3d720 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2ca3d720 Branch: refs/heads/ignite-971 Commit: 2ca3d7205a3bf3b4ffb5f04b9c17d25dbe181379 Parents: fcfc379 Author: sboikov <[email protected]> Authored: Mon Sep 14 12:22:16 2015 +0300 Committer: sboikov <[email protected]> Committed: Mon Sep 14 12:22:16 2015 +0300 ---------------------------------------------------------------------- .../IgniteCacheCrossCacheTxFailoverTest.java | 53 +++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2ca3d720/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java index 4c52e6f..7425e23 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java @@ -40,7 +40,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; 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.spi.swapspace.file.FileSwapSpaceSpi; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -51,6 +51,9 @@ import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.cache.CacheMode.REPLICATED; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC; +import static org.apache.ignite.testframework.GridTestUtils.TestMemoryMode; +import static org.apache.ignite.testframework.GridTestUtils.runMultiThreadedAsync; +import static org.apache.ignite.testframework.GridTestUtils.setMemoryMode; import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; @@ -86,6 +89,8 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest if (gridName.equals(getTestGridName(GRID_CNT - 1))) cfg.setClientMode(true); + cfg.setSwapSpaceSpi(new FileSwapSpaceSpi()); + return cfg; } @@ -107,9 +112,13 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest * @param name Cache name. * @param cacheMode Cache mode. * @param parts Number of partitions. + * @param memMode Memory mode. * @return Cache configuration. */ - private CacheConfiguration cacheConfiguration(String name, CacheMode cacheMode, int parts) { + private CacheConfiguration cacheConfiguration(String name, + CacheMode cacheMode, + int parts, + TestMemoryMode memMode) { CacheConfiguration ccfg = new CacheConfiguration(); ccfg.setName(name); @@ -122,6 +131,8 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest ccfg.setAffinity(new RendezvousAffinityFunction(false, parts)); + setMemoryMode(null, ccfg, memMode, 100, 1024); + return ccfg; } @@ -134,49 +145,63 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest * @throws Exception If failed. */ public void testCrossCachePessimisticTxFailover() throws Exception { - crossCacheTxFailover(PARTITIONED, true, PESSIMISTIC, REPEATABLE_READ); + crossCacheTxFailover(PARTITIONED, true, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP); + } + + /** + * @throws Exception If failed. + */ + public void testCrossCachePessimisticTxFailoverOffheapSwap() throws Exception { + crossCacheTxFailover(PARTITIONED, true, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.OFFHEAP_EVICT_SWAP); } /** * @throws Exception If failed. */ public void testCrossCachePessimisticTxFailoverDifferentAffinity() throws Exception { - crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ); + crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP); } /** * @throws Exception If failed. */ public void testCrossCacheOptimisticTxFailover() throws Exception { - crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, REPEATABLE_READ); + crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP); + } + + /** + * @throws Exception If failed. + */ + public void testCrossCacheOptimisticTxFailoverOffheapSwap() throws Exception { + crossCacheTxFailover(PARTITIONED, true, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.OFFHEAP_EVICT_SWAP); } /** * @throws Exception If failed. */ public void testCrossCacheOptimisticTxFailoverDifferentAffinity() throws Exception { - crossCacheTxFailover(PARTITIONED, false, OPTIMISTIC, REPEATABLE_READ); + crossCacheTxFailover(PARTITIONED, false, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP); } /** * @throws Exception If failed. */ public void testCrossCachePessimisticTxFailoverReplicated() throws Exception { - crossCacheTxFailover(REPLICATED, true, PESSIMISTIC, REPEATABLE_READ); + crossCacheTxFailover(REPLICATED, true, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP); } /** * @throws Exception If failed. */ public void testCrossCacheOptimisticTxFailoverReplicated() throws Exception { - crossCacheTxFailover(REPLICATED, true, OPTIMISTIC, REPEATABLE_READ); + crossCacheTxFailover(REPLICATED, true, OPTIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP); } /** * @throws Exception If failed. */ public void testCrossCachePessimisticTxFailoverDifferentAffinityReplicated() throws Exception { - crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ); + crossCacheTxFailover(PARTITIONED, false, PESSIMISTIC, REPEATABLE_READ, TestMemoryMode.HEAP); } /** @@ -184,23 +209,25 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest * @param sameAff If {@code false} uses different number of partitions for caches. * @param concurrency Transaction concurrency. * @param isolation Transaction isolation. + * @param memMode Memory mode. * @throws Exception If failed. */ private void crossCacheTxFailover(CacheMode cacheMode, boolean sameAff, final TransactionConcurrency concurrency, - final TransactionIsolation isolation) throws Exception { + final TransactionIsolation isolation, + TestMemoryMode memMode) throws Exception { IgniteKernal ignite0 = (IgniteKernal)ignite(0); final AtomicBoolean stop = new AtomicBoolean(); try { - ignite0.createCache(cacheConfiguration(CACHE1, cacheMode, 256)); - ignite0.createCache(cacheConfiguration(CACHE2, cacheMode, sameAff ? 256 : 128)); + ignite0.createCache(cacheConfiguration(CACHE1, cacheMode, 256, memMode)); + ignite0.createCache(cacheConfiguration(CACHE2, cacheMode, sameAff ? 256 : 128, memMode)); final AtomicInteger threadIdx = new AtomicInteger(); - IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() { + IgniteInternalFuture<?> fut = runMultiThreadedAsync(new Callable<Void>() { @Override public Void call() throws Exception { int idx = threadIdx.getAndIncrement();
