http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java index 0452ad4..fef4d4b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsPartitionPreloadTest.java @@ -41,6 +41,9 @@ 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.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC; import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL; @@ -49,6 +52,7 @@ import static org.apache.ignite.cache.CacheMode.LOCAL; /** * Test partition preload for varios cache modes. */ +@RunWith(JUnit4.class) public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -152,6 +156,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testLocalPreloadPartitionClient() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setDataRegionName(MEM); @@ -166,6 +171,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testLocalPreloadPartitionPrimary() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -174,6 +180,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testLocalPreloadPartitionBackup() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -182,6 +189,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionInMemoryRemote() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setDataRegionName(MEM); @@ -202,6 +210,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionInMemoryLocal() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setDataRegionName(MEM); @@ -224,6 +233,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalClientSync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -238,6 +248,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalClientAsync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -252,6 +263,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalNodeFilteredSync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -259,6 +271,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalNodeFilteredAsync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -266,6 +279,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalPrimarySync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -274,6 +288,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalPrimaryAsync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -282,6 +297,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalBackupSync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -290,6 +306,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionTransactionalBackupAsync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL); @@ -298,6 +315,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicClientSync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -312,6 +330,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicClientAsync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -326,6 +345,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicNodeFilteredSync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -333,6 +353,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicNodeFilteredAsync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -340,6 +361,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicPrimarySync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -348,6 +370,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicPrimaryAsync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -356,6 +379,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicBackupSync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -364,6 +388,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadPartitionAtomicBackupAsync() throws Exception { cfgFactory = () -> cacheConfiguration(ATOMIC); @@ -372,6 +397,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadLocalTransactionalSync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setCacheMode(LOCAL); @@ -380,6 +406,7 @@ public class IgnitePdsPartitionPreloadTest extends GridCommonAbstractTest { } /** */ + @Test public void testPreloadLocalTransactionalAsync() throws Exception { cfgFactory = () -> cacheConfiguration(TRANSACTIONAL).setCacheMode(LOCAL);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java index 8b3c875..4fd2b79 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsRebalancingOnNotStableTopologyTest.java @@ -35,6 +35,9 @@ import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * We start writing to unstable cluster. @@ -42,6 +45,7 @@ import org.apache.ignite.testframework.junits.multijvm.IgniteProcessProxy; * There will be entries in WAL which belongs to evicted partitions. * We should ignore them (not throw exceptions). This point is tested. */ +@RunWith(JUnit4.class) public class IgnitePdsRebalancingOnNotStableTopologyTest extends GridCommonAbstractTest { /** Checkpoint frequency. */ private static final long CHECKPOINT_FREQUENCY = 2_000_000; @@ -55,6 +59,7 @@ public class IgnitePdsRebalancingOnNotStableTopologyTest extends GridCommonAbstr /** * @throws Exception When fails. */ + @Test public void test() throws Exception { Ignite ex = startGrid(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java index cfbb8d8..2853a52 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsReserveWalSegmentsTest.java @@ -33,12 +33,16 @@ 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.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.IgniteSystemProperties.IGNITE_PDS_MAX_CHECKPOINT_MEMORY_HISTORY_SIZE; /** * Test correctness of truncating unused WAL segments. */ +@RunWith(JUnit4.class) public class IgnitePdsReserveWalSegmentsTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -93,6 +97,7 @@ public class IgnitePdsReserveWalSegmentsTest extends GridCommonAbstractTest { * * @throws Exception if failed. */ + @Test public void testWalManagerRangeReservation() throws Exception { IgniteEx ig0 = prepareGrid(4); @@ -122,6 +127,7 @@ public class IgnitePdsReserveWalSegmentsTest extends GridCommonAbstractTest { * * @throws Exception if failed. */ + @Test public void testWalDoesNotTruncatedWhenSegmentReserved() throws Exception { IgniteEx ig0 = prepareGrid(4); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java index 36afe32..72eeb96 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsTransactionsHangTest.java @@ -46,6 +46,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionIsolation; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC; import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ; @@ -53,6 +56,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA /** * Checks that transactions don't hang during checkpoint creation. */ +@RunWith(JUnit4.class) public class IgnitePdsTransactionsHangTest extends GridCommonAbstractTest { /** IP finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -164,6 +168,7 @@ public class IgnitePdsTransactionsHangTest extends GridCommonAbstractTest { * * @throws Exception If failed. * */ + @Test public void testTransactionsDontHang() throws Exception { try { final Ignite g = startGrids(2); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java index 2458e21..919888af 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWholeClusterRestartTest.java @@ -33,10 +33,14 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.WALMode; import org.apache.ignite.spi.checkpoint.noop.NoopCheckpointSpi; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgnitePdsWholeClusterRestartTest extends GridCommonAbstractTest { /** */ private static final int GRID_CNT = 5; @@ -96,6 +100,7 @@ public class IgnitePdsWholeClusterRestartTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testRestarts() throws Exception { startGrids(GRID_CNT); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java index bb371dc..a14fd42 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgnitePdsWithTtlTest.java @@ -42,10 +42,14 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test TTL worker with persistence enabled */ +@RunWith(JUnit4.class) public class IgnitePdsWithTtlTest extends GridCommonAbstractTest { /** */ public static final String CACHE_NAME = "expirableCache"; @@ -110,6 +114,7 @@ public class IgnitePdsWithTtlTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testTtlIsApplied() throws Exception { loadAndWaitForCleanup(false); } @@ -117,6 +122,7 @@ public class IgnitePdsWithTtlTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testTtlIsAppliedAfterRestart() throws Exception { loadAndWaitForCleanup(true); } @@ -148,6 +154,7 @@ public class IgnitePdsWithTtlTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testRebalancingWithTtlExpirable() throws Exception { IgniteEx srv = startGrid(0); srv.cluster().active(true); @@ -171,6 +178,7 @@ public class IgnitePdsWithTtlTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testStartStopAfterRebalanceWithTtlExpirable() throws Exception { try { IgniteEx srv = startGrid(0); @@ -243,4 +251,4 @@ public class IgnitePdsWithTtlTest extends GridCommonAbstractTest { cache.context().printMemoryStats(); System.out.println("}} " + msg); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/SlowHistoricalRebalanceSmallHistoryTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/SlowHistoricalRebalanceSmallHistoryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/SlowHistoricalRebalanceSmallHistoryTest.java index bd1a1a9..744b532 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/SlowHistoricalRebalanceSmallHistoryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/SlowHistoricalRebalanceSmallHistoryTest.java @@ -43,10 +43,14 @@ 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.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class SlowHistoricalRebalanceSmallHistoryTest extends GridCommonAbstractTest { /** Ip finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -118,6 +122,7 @@ public class SlowHistoricalRebalanceSmallHistoryTest extends GridCommonAbstractT /** * Checks that we reserve and release the same WAL index on exchange. */ + @Test public void testReservation() throws Exception { IgniteEx ig = startGrid(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java index c9174ba..c1f34f9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteCheckpointDirtyPagesForLowLoadTest.java @@ -36,11 +36,15 @@ import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException; import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test generates low load to grid in having some shared groups. Test checks if pages marked dirty after some time will * became reasonable low for 1 put. */ +@RunWith(JUnit4.class) public class IgniteCheckpointDirtyPagesForLowLoadTest extends GridCommonAbstractTest { /** Caches in group. */ private static final int CACHES_IN_GRP = 1; @@ -98,6 +102,7 @@ public class IgniteCheckpointDirtyPagesForLowLoadTest extends GridCommonAbstract /** * @throws Exception if failed. */ + @Test public void testManyCachesAndNotManyPuts() throws Exception { try { IgniteEx ignite = startGrid(0); @@ -205,4 +210,4 @@ public class IgniteCheckpointDirtyPagesForLowLoadTest extends GridCommonAbstract return currCpPages; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java index f38db0a..4394891 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/checkpoint/IgniteMassLoadSandboxTest.java @@ -57,6 +57,9 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridStringLogger; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR; @@ -64,6 +67,7 @@ import static org.apache.ignite.internal.processors.cache.persistence.file.FileP * Sandbox test to measure progress of grid write operations. If no progress occur during period of time, then thread * dumps are generated. */ +@RunWith(JUnit4.class) public class IgniteMassLoadSandboxTest extends GridCommonAbstractTest { /** Cache name. Random to cover external stores possible problems. */ public static final String CACHE_NAME = "partitioned" + new Random().nextInt(10000000); @@ -173,6 +177,7 @@ public class IgniteMassLoadSandboxTest extends GridCommonAbstractTest { * * @throws Exception if failed. */ + @Test public void testContinuousPutMultithreaded() throws Exception { try { // System.setProperty(IgniteSystemProperties.IGNITE_DIRTY_PAGES_PARALLEL, "true"); @@ -233,6 +238,7 @@ public class IgniteMassLoadSandboxTest extends GridCommonAbstractTest { * * @throws Exception if failed. */ + @Test public void testDataStreamerContinuousPutMultithreaded() throws Exception { try { // System.setProperty(IgniteSystemProperties.IGNITE_DIRTY_PAGES_PARALLEL, "true"); @@ -309,6 +315,7 @@ public class IgniteMassLoadSandboxTest extends GridCommonAbstractTest { * * @throws Exception if failed. */ + @Test public void testCoveredWalLogged() throws Exception { GridStringLogger log0 = null; @@ -484,6 +491,7 @@ public class IgniteMassLoadSandboxTest extends GridCommonAbstractTest { * * @throws Exception if failed. */ + @Test public void testPutRemoveMultithreaded() throws Exception { setWalArchAndWorkToSameVal = false; customWalMode = WALMode.LOG_ONLY; http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java index 70d003d..fde76de 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/DefaultPageSizeBackwardsCompatibilityTest.java @@ -29,10 +29,14 @@ 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.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstractTest { /** Ip finder. */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -104,6 +108,7 @@ public class DefaultPageSizeBackwardsCompatibilityTest extends GridCommonAbstrac /** * @throws Exception If failed. */ + @Test public void testStartFrom16kDefaultStore() throws Exception { startGrids(2); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheDestroyDuringCheckpointTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheDestroyDuringCheckpointTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheDestroyDuringCheckpointTest.java index 62cc244..1d95bfe 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheDestroyDuringCheckpointTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheDestroyDuringCheckpointTest.java @@ -28,10 +28,14 @@ import org.apache.ignite.configuration.DataStorageConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test for cache creation/deletion with frequent checkpoints. */ +@RunWith(JUnit4.class) public class IgnitePdsCacheDestroyDuringCheckpointTest extends GridCommonAbstractTest { /** */ private static final String NAME_PREFIX = "CACHE-"; @@ -90,6 +94,7 @@ public class IgnitePdsCacheDestroyDuringCheckpointTest extends GridCommonAbstrac /** * @throws Exception If fail. */ + @Test public void testCacheCreatePutCheckpointDestroy() throws Exception { IgniteEx ig = startGrid(0); ig.active(true); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java index ba9a000..213104b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCacheIntegrationTest.java @@ -43,10 +43,14 @@ 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.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgnitePdsCacheIntegrationTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -111,6 +115,7 @@ public class IgnitePdsCacheIntegrationTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testPutGetSimple() throws Exception { startGrids(GRID_CNT); @@ -146,6 +151,7 @@ public class IgnitePdsCacheIntegrationTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testPutMultithreaded() throws Exception { startGrids(4); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimpleTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimpleTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimpleTest.java index eafa2af..28cb69e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimpleTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimpleTest.java @@ -26,10 +26,14 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.NotNull; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Puts data into grid, waits for checkpoint to start and then verifies data */ +@RunWith(JUnit4.class) public class IgnitePdsCheckpointSimpleTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @@ -64,6 +68,7 @@ public class IgnitePdsCheckpointSimpleTest extends GridCommonAbstractTest { * Checks if same data can be loaded after checkpoint. * @throws Exception if failed. */ + @Test public void testRecoveryAfterCpEnd() throws Exception { IgniteEx ignite = startGrid(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java index 620814f..919a58e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java @@ -80,11 +80,15 @@ 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.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test simulated chekpoints, * Disables integrated check pointer thread */ +@RunWith(JUnit4.class) public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -146,6 +150,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom /** * @throws Exception if failed. */ + @Test public void testCheckpointSimulationMultiThreaded() throws Exception { IgniteEx ig = startGrid(0); @@ -203,6 +208,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom /** * @throws Exception if failed. */ + @Test public void testGetForInitialWrite() throws Exception { IgniteEx ig = startGrid(0); @@ -303,6 +309,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom /** * @throws Exception if failed. */ + @Test public void testDataWalEntries() throws Exception { IgniteEx ig = startGrid(0); @@ -410,6 +417,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom /** * @throws Exception if failed. */ + @Test public void testPageWalEntries() throws Exception { IgniteEx ig = startGrid(0); @@ -510,6 +518,7 @@ public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCom /** * @throws Exception if failed. */ + @Test public void testDirtyFlag() throws Exception { IgniteEx ig = startGrid(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java index 7e17271..837637f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsDiskErrorsRecoveringTest.java @@ -50,12 +50,16 @@ import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAhea import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.IgniteSystemProperties.IGNITE_WAL_MMAP; /** * Tests node recovering after disk errors during interaction with persistent storage. */ +@RunWith(JUnit4.class) public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest { /** */ private static final int PAGE_SIZE = DataStorageConfiguration.DFLT_PAGE_SIZE; @@ -123,6 +127,7 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest { /** * Test node stopping & recovering on cache initialization fail. */ + @Test public void testRecoveringOnCacheInitFail() throws Exception { // Fail to initialize page store. 2 extra pages is needed for MetaStorage. ioFactory = new FilteringFileIOFactory(".bin", new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), 2 * PAGE_SIZE)); @@ -164,6 +169,7 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest { * * @throws Exception If test failed. */ + @Test public void testRecoveringOnCheckpointBeginFail() throws Exception { // Fail to write checkpoint start marker tmp file at the second checkpoint. Pass only initial checkpoint. ioFactory = new FilteringFileIOFactory("START.bin" + FilePageStoreManager.TMP_SUFFIX, new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), 20)); @@ -214,6 +220,7 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest { /** * Test node stopping & recovering on checkpoint pages write fail. */ + @Test public void testRecoveringOnCheckpointWriteFail() throws Exception { // Fail write partition and index files at the second checkpoint. Pass only initial checkpoint. ioFactory = new FilteringFileIOFactory(".bin", new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), 128 * PAGE_SIZE)); @@ -263,6 +270,7 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest { /** * Test node stopping & recovering on WAL writing fail with enabled MMAP (Batch allocation for WAL segments). */ + @Test public void testRecoveringOnWALWritingFail1() throws Exception { // Allow to allocate only 1 wal segment, fail on write to second. ioFactory = new FilteringFileIOFactory(".wal", new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), WAL_SEGMENT_SIZE)); @@ -275,6 +283,7 @@ public class IgnitePdsDiskErrorsRecoveringTest extends GridCommonAbstractTest { /** * Test node stopping & recovering on WAL writing fail with disabled MMAP. */ + @Test public void testRecoveringOnWALWritingFail2() throws Exception { // Fail somewhere on the second wal segment. ioFactory = new FilteringFileIOFactory(".wal", new LimitedSizeFileIOFactory(new RandomAccessFileIOFactory(), (long) (1.5 * WAL_SEGMENT_SIZE))); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java index c2967fe..41e027e 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsNoActualWalHistoryTest.java @@ -36,10 +36,14 @@ import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabase import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgnitePdsNoActualWalHistoryTest extends GridCommonAbstractTest { /** Cache name. */ private static final String CACHE_NAME = "cache"; @@ -98,6 +102,7 @@ public class IgnitePdsNoActualWalHistoryTest extends GridCommonAbstractTest { /** * @throws Exception if failed. */ + @Test public void testWalBig() throws Exception { try { IgniteEx ignite = startGrid(1); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsPageReplacementTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsPageReplacementTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsPageReplacementTest.java index 2697c01..7be0625 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsPageReplacementTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsPageReplacementTest.java @@ -40,11 +40,15 @@ import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO; import org.apache.ignite.internal.util.typedef.internal.CU; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test for page replacement (rotation with disk) process with enabled persistence. * A lot of reader threads tries to acquire page and checkpointer threads write data. */ +@RunWith(JUnit4.class) public class IgnitePdsPageReplacementTest extends GridCommonAbstractTest { /** */ private static final int NUMBER_OF_SEGMENTS = 64; @@ -113,6 +117,7 @@ public class IgnitePdsPageReplacementTest extends GridCommonAbstractTest { /** * @throws Exception If fail. */ + @Test public void testPageReplacement() throws Exception { final IgniteEx ig = startGrid(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java index adaa764..4b7db7d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsThreadInterruptionTest.java @@ -30,10 +30,14 @@ import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.configuration.WALMode; import org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Test what interruptions of writing threads do not affect PDS. */ +@RunWith(JUnit4.class) public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest { /** */ private static final int PAGE_SIZE = 1 << 12; // 4096 @@ -106,6 +110,7 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest { * * @throws Exception If failed. */ + @Test public void testInterruptsOnLFSRead() throws Exception { final Ignite ignite = startGrid(); @@ -185,6 +190,7 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest { * * @throws Exception */ + @Test public void testInterruptsOnWALWrite() throws Exception { final Ignite ignite = startGrid(); @@ -256,4 +262,4 @@ public class IgnitePdsThreadInterruptionTest extends GridCommonAbstractTest { log.info("Verified keys: " + verifiedKeys); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java index 6e8ef65..b3e36c9 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/filename/IgniteUidAsConsistentIdMigrationTest.java @@ -36,6 +36,9 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridStringLogger; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.jetbrains.annotations.NotNull; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.IgniteSystemProperties.IGNITE_CONSISTENT_ID_BY_HOST_WITHOUT_PORT; import static org.apache.ignite.IgniteSystemProperties.IGNITE_DATA_STORAGE_FOLDER_BY_CONSISTENT_ID; @@ -44,6 +47,7 @@ import static org.apache.ignite.internal.processors.cache.persistence.filename.P /** * Test for new and old style persistent storage folders generation */ +@RunWith(JUnit4.class) public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest { /** Cache name for test. */ public static final String CACHE_NAME = "dummy"; @@ -160,6 +164,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed. */ + @Test public void testNewStyleIdIsGenerated() throws Exception { final Ignite ignite = startActivateFillDataGrid(0); @@ -174,6 +179,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed. */ + @Test public void testNewStyleIdIsGeneratedInCustomStorePath() throws Exception { placeStorageInTemp = true; final Ignite ignite = startActivateFillDataGrid(0); @@ -196,6 +202,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed. */ + @Test public void testPreconfiguredConsitentIdIsApplied() throws Exception { this.configuredConsistentId = "someConfiguredConsistentId"; Ignite ignite = startActivateFillDataGrid(0); @@ -210,6 +217,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed */ + @Test public void testRestartOnExistingOldStyleId() throws Exception { final String expDfltConsistentId = "127.0.0.1:47500"; @@ -244,6 +252,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed */ + @Test public void testStartWithoutActivate() throws Exception { //start stop grid without activate startGrid(0); @@ -259,6 +268,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed */ + @Test public void testRestartOnSameFolderWillCauseSameUuidGeneration() throws Exception { final UUID uuid; { @@ -290,6 +300,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed */ + @Test public void testStartNodeAfterDeactivate() throws Exception { final UUID uuid; { @@ -365,6 +376,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed */ + @Test public void testNodeIndexIncremented() throws Exception { final Ignite ignite0 = startGrid(0); final Ignite ignite1 = startGrid(1); @@ -387,6 +399,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed */ + @Test public void testNewStyleAlwaysSmallestNodeIndexIsCreated() throws Exception { final Ignite ignite0 = startGrid(0); final Ignite ignite1 = startGrid(1); @@ -419,6 +432,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed */ + @Test public void testNewStyleAlwaysSmallestNodeIndexIsCreatedMultithreaded() throws Exception { final Ignite ignite0 = startGridsMultiThreaded(11); @@ -446,6 +460,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed. */ + @Test public void testStartTwoOldStyleNodes() throws Exception { final String expDfltConsistentId1 = "127.0.0.1:47500"; @@ -495,6 +510,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed. */ + @Test public void testStartOldStyleNodesByCompatibleProperty() throws Exception { clearPropsAfterTest = true; System.setProperty(IGNITE_DATA_STORAGE_FOLDER_BY_CONSISTENT_ID, "true"); @@ -537,6 +553,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed. */ + @Test public void testStartOldStyleNoPortsNodesByCompatibleProperty() throws Exception { clearPropsAfterTest = true; System.setProperty(IGNITE_DATA_STORAGE_FOLDER_BY_CONSISTENT_ID, "true"); @@ -577,6 +594,7 @@ public class IgniteUidAsConsistentIdMigrationTest extends GridCommonAbstractTest * * @throws Exception if failed. */ + @Test public void testOldStyleNodeWithUnexpectedPort() throws Exception { this.configuredConsistentId = "127.0.0.1:49999"; //emulated old-style node with not appropriate consistent ID final Ignite ignite = startActivateFillDataGrid(0); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/FsyncWalRolloverDoesNotBlockTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/FsyncWalRolloverDoesNotBlockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/FsyncWalRolloverDoesNotBlockTest.java index aa2e90c..5bfb648 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/FsyncWalRolloverDoesNotBlockTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/FsyncWalRolloverDoesNotBlockTest.java @@ -26,11 +26,15 @@ 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.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH; import static org.apache.ignite.configuration.WALMode.FSYNC; /** */ +@RunWith(JUnit4.class) public class FsyncWalRolloverDoesNotBlockTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -72,6 +76,7 @@ public class FsyncWalRolloverDoesNotBlockTest extends GridCommonAbstractTest { } /** */ + @Test public void test() throws Exception { IgniteEx ig = startGrid(0); @@ -86,4 +91,4 @@ public class FsyncWalRolloverDoesNotBlockTest extends GridCommonAbstractTest { ig.context().cache().context().database().checkpointReadUnlock(); } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java index 1a1d449..f6dbdd3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteNodeStoppedDuringDisableWALTest.java @@ -43,6 +43,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static java.nio.file.FileVisitResult.CONTINUE; import static java.nio.file.Files.walkFileTree; @@ -57,6 +60,7 @@ import static org.apache.ignite.testframework.GridTestUtils.setFieldValue; /*** * */ +@RunWith(JUnit4.class) public class IgniteNodeStoppedDuringDisableWALTest extends GridCommonAbstractTest { /** */ public static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -94,6 +98,7 @@ public class IgniteNodeStoppedDuringDisableWALTest extends GridCommonAbstractTes * * @throws Exception If failed. */ + @Test public void test() throws Exception { for (NodeStopPoint nodeStopPoint : NodeStopPoint.values()) { testStopNodeWithDisableWAL(nodeStopPoint); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWALTailIsReachedDuringIterationOverArchiveTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWALTailIsReachedDuringIterationOverArchiveTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWALTailIsReachedDuringIterationOverArchiveTest.java index e3c2c6c..c00e4e0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWALTailIsReachedDuringIterationOverArchiveTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWALTailIsReachedDuringIterationOverArchiveTest.java @@ -49,6 +49,9 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static java.nio.ByteBuffer.allocate; import static java.nio.file.StandardOpenOption.WRITE; @@ -57,6 +60,7 @@ import static java.util.concurrent.ThreadLocalRandom.current; /** * */ +@RunWith(JUnit4.class) public class IgniteWALTailIsReachedDuringIterationOverArchiveTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -118,6 +122,7 @@ public class IgniteWALTailIsReachedDuringIterationOverArchiveTest extends GridCo /** * @throws Exception If failed. */ + @Test public void testStandAloneIterator() throws Exception { IgniteEx ig = grid(); @@ -133,6 +138,7 @@ public class IgniteWALTailIsReachedDuringIterationOverArchiveTest extends GridCo /** * @throws Exception If failed. */ + @Test public void testWALManagerIterator() throws Exception { IgniteEx ig = grid(); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java index 8b182c9..d3988d2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushFailoverTest.java @@ -43,10 +43,14 @@ 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.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgniteWalFlushFailoverTest extends GridCommonAbstractTest { /** */ private static final String TEST_CACHE = "testCache"; @@ -100,6 +104,7 @@ public class IgniteWalFlushFailoverTest extends GridCommonAbstractTest { * * @throws Exception In case of fail */ + @Test public void testErrorOnFlushByTimeout() throws Exception { flushByTimeout = true; flushingErrorTest(); @@ -110,6 +115,7 @@ public class IgniteWalFlushFailoverTest extends GridCommonAbstractTest { * * @throws Exception In case of fail */ + @Test public void testErrorOnDirectFlush() throws Exception { flushByTimeout = false; flushingErrorTest(); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java index 232591c..bdce9f3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java @@ -47,10 +47,14 @@ 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.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Tests error recovery while node flushing */ +@RunWith(JUnit4.class) public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends GridCommonAbstractTest { /** */ private static final String TEST_CACHE = "testCache"; @@ -138,6 +142,7 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr * * @throws Exception In case of fail */ + @Test public void testFailWhileStart() throws Exception { failWhilePut(true); } @@ -147,6 +152,7 @@ public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends Gr * * @throws Exception In case of fail */ + @Test public void testFailAfterStart() throws Exception { failWhilePut(false); } http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java index e603686..617ec9a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFormatFileFailoverTest.java @@ -1,253 +1,260 @@ -/* - * 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.persistence.db.wal; - -import java.io.File; -import java.io.IOException; -import java.nio.file.OpenOption; -import java.util.Arrays; -import java.util.concurrent.atomic.AtomicReference; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.cache.CacheAtomicityMode; -import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.configuration.DataRegionConfiguration; -import org.apache.ignite.configuration.DataStorageConfiguration; -import org.apache.ignite.configuration.IgniteConfiguration; -import org.apache.ignite.configuration.WALMode; -import org.apache.ignite.failure.FailureHandler; -import org.apache.ignite.failure.TestFailureHandler; -import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager; -import org.apache.ignite.internal.processors.cache.persistence.StorageException; -import org.apache.ignite.internal.processors.cache.persistence.file.FileIO; -import org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator; -import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory; -import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory; -import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager; -import org.apache.ignite.internal.util.typedef.X; -import org.apache.ignite.testframework.GridTestUtils; -import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; - -/** - * - */ -public class IgniteWalFormatFileFailoverTest extends GridCommonAbstractTest { - /** */ - private static final String TEST_CACHE = "testCache"; - - /** */ - private static final String formatFile = "formatFile"; - - /** Fail method name reference. */ - private final AtomicReference<String> failMtdNameRef = new AtomicReference<>(); - - /** */ - private boolean fsync; - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - cleanPersistenceDir(); - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - - cleanPersistenceDir(); - } - - /** {@inheritDoc} */ - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE) - .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); - - DataStorageConfiguration memCfg = new DataStorageConfiguration() - .setDefaultDataRegionConfiguration(new DataRegionConfiguration() - .setMaxSize(2048L * 1024 * 1024) - .setPersistenceEnabled(true)) - .setWalMode(fsync ? WALMode.FSYNC : WALMode.BACKGROUND) - .setWalBufferSize(1024 * 1024) - .setWalSegmentSize(512 * 1024) - .setFileIOFactory(new FailingFileIOFactory(failMtdNameRef)); - - cfg.setDataStorageConfiguration(memCfg); - - cfg.setFailureHandler(new TestFailureHandler(false)); - - return cfg; - } - - /** - * @throws Exception If failed. - */ - public void testNodeStartFailedFsync() throws Exception { - fsync = true; - - failMtdNameRef.set(formatFile); - - checkCause(GridTestUtils.assertThrows(log, () -> startGrid(0), IgniteCheckedException.class, null)); - } - - /** - * @throws Exception If failed. - */ - public void testFailureHandlerTriggeredFsync() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-10035"); - - fsync = true; - - failFormatFileOnClusterActivate(); - } - - /** - * @throws Exception If failed. - */ - public void testFailureHandlerTriggered() throws Exception { - fail("https://issues.apache.org/jira/browse/IGNITE-10035"); - - fsync = false; - - failFormatFileOnClusterActivate(); - } - - /** - * @throws Exception If failed. - */ - private void failFormatFileOnClusterActivate() throws Exception { - failMtdNameRef.set(null); - - startGrid(0); - startGrid(1); - - if (!fsync) { - setFileIOFactory(grid(0).context().cache().context().wal()); - setFileIOFactory(grid(1).context().cache().context().wal()); - } - - failMtdNameRef.set(formatFile); - - grid(0).cluster().active(true); - - checkCause(failureHandler(0).awaitFailure(2000).error()); - checkCause(failureHandler(1).awaitFailure(2000).error()); - } - - /** - * @param mtdName Method name. - */ - private static boolean isCalledFrom(String mtdName) { - return isCalledFrom(Thread.currentThread().getStackTrace(), mtdName); - } - - /** - * @param stackTrace Stack trace. - * @param mtdName Method name. - */ - private static boolean isCalledFrom(StackTraceElement[] stackTrace, String mtdName) { - return Arrays.stream(stackTrace).map(StackTraceElement::getMethodName).anyMatch(mtdName::equals); - } - - /** - * @param gridIdx Grid index. - * @return Failure handler configured for grid with given index. - */ - private TestFailureHandler failureHandler(int gridIdx) { - FailureHandler hnd = grid(gridIdx).configuration().getFailureHandler(); - - assertTrue(hnd instanceof TestFailureHandler); - - return (TestFailureHandler)hnd; - } - - /** - * @param t Throwable. - */ - private void checkCause(Throwable t) { - StorageException e = X.cause(t, StorageException.class); - - assertNotNull(e); - assertNotNull(e.getMessage()); - assertTrue(e.getMessage().contains("Failed to format WAL segment file")); - - IOException ioe = X.cause(e, IOException.class); - - assertNotNull(ioe); - assertNotNull(ioe.getMessage()); - assertTrue(ioe.getMessage().contains("No space left on device")); - - assertTrue(isCalledFrom(ioe.getStackTrace(), formatFile)); - } - - /** */ - private void setFileIOFactory(IgniteWriteAheadLogManager wal) { - if (wal instanceof FileWriteAheadLogManager) - ((FileWriteAheadLogManager)wal).setFileIOFactory(new FailingFileIOFactory(failMtdNameRef)); - else - fail(wal.getClass().toString()); - } - - /** - * Create File I/O which fails if specific method call present in stack trace. - */ - private static class FailingFileIOFactory implements FileIOFactory { - /** Serial version uid. */ - private static final long serialVersionUID = 0L; - - /** Delegate factory. */ - private final FileIOFactory delegateFactory = new RandomAccessFileIOFactory(); - - /** Fail method name reference. */ - private final AtomicReference<String> failMtdNameRef; - - /** - * @param failMtdNameRef Fail method name reference. - */ - FailingFileIOFactory(AtomicReference<String> failMtdNameRef) { - assertNotNull(failMtdNameRef); - - this.failMtdNameRef = failMtdNameRef; - } - - /** {@inheritDoc} */ - @Override public FileIO create(File file, OpenOption... modes) throws IOException { - final FileIO delegate = delegateFactory.create(file, modes); - - return new FileIODecorator(delegate) { - @Override public int write(byte[] buf, int off, int len) throws IOException { - conditionalFail(); - - return super.write(buf, off, len); - } - - @Override public void clear() throws IOException { - conditionalFail(); - - super.clear(); - } - - private void conditionalFail() throws IOException { - String failMtdName = failMtdNameRef.get(); - - if (failMtdName != null && isCalledFrom(failMtdName)) - throw new IOException("No space left on device"); - } - }; - } - } -} +/* + * 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.persistence.db.wal; + +import java.io.File; +import java.io.IOException; +import java.nio.file.OpenOption; +import java.util.Arrays; +import java.util.concurrent.atomic.AtomicReference; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.configuration.WALMode; +import org.apache.ignite.failure.FailureHandler; +import org.apache.ignite.failure.TestFailureHandler; +import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager; +import org.apache.ignite.internal.processors.cache.persistence.StorageException; +import org.apache.ignite.internal.processors.cache.persistence.file.FileIO; +import org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator; +import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory; +import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory; +import org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager; +import org.apache.ignite.internal.util.typedef.X; +import org.apache.ignite.testframework.GridTestUtils; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** + * + */ +@RunWith(JUnit4.class) +public class IgniteWalFormatFileFailoverTest extends GridCommonAbstractTest { + /** */ + private static final String TEST_CACHE = "testCache"; + + /** */ + private static final String formatFile = "formatFile"; + + /** Fail method name reference. */ + private final AtomicReference<String> failMtdNameRef = new AtomicReference<>(); + + /** */ + private boolean fsync; + + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + cleanPersistenceDir(); + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); + + cleanPersistenceDir(); + } + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE) + .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); + + DataStorageConfiguration memCfg = new DataStorageConfiguration() + .setDefaultDataRegionConfiguration(new DataRegionConfiguration() + .setMaxSize(2048L * 1024 * 1024) + .setPersistenceEnabled(true)) + .setWalMode(fsync ? WALMode.FSYNC : WALMode.BACKGROUND) + .setWalBufferSize(1024 * 1024) + .setWalSegmentSize(512 * 1024) + .setFileIOFactory(new FailingFileIOFactory(failMtdNameRef)); + + cfg.setDataStorageConfiguration(memCfg); + + cfg.setFailureHandler(new TestFailureHandler(false)); + + return cfg; + } + + /** + * @throws Exception If failed. + */ + @Test + public void testNodeStartFailedFsync() throws Exception { + fsync = true; + + failMtdNameRef.set(formatFile); + + checkCause(GridTestUtils.assertThrows(log, () -> startGrid(0), IgniteCheckedException.class, null)); + } + + /** + * @throws Exception If failed. + */ + @Test + public void testFailureHandlerTriggeredFsync() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-10035"); + + fsync = true; + + failFormatFileOnClusterActivate(); + } + + /** + * @throws Exception If failed. + */ + @Test + public void testFailureHandlerTriggered() throws Exception { + fail("https://issues.apache.org/jira/browse/IGNITE-10035"); + + fsync = false; + + failFormatFileOnClusterActivate(); + } + + /** + * @throws Exception If failed. + */ + private void failFormatFileOnClusterActivate() throws Exception { + failMtdNameRef.set(null); + + startGrid(0); + startGrid(1); + + if (!fsync) { + setFileIOFactory(grid(0).context().cache().context().wal()); + setFileIOFactory(grid(1).context().cache().context().wal()); + } + + failMtdNameRef.set(formatFile); + + grid(0).cluster().active(true); + + checkCause(failureHandler(0).awaitFailure(2000).error()); + checkCause(failureHandler(1).awaitFailure(2000).error()); + } + + /** + * @param mtdName Method name. + */ + private static boolean isCalledFrom(String mtdName) { + return isCalledFrom(Thread.currentThread().getStackTrace(), mtdName); + } + + /** + * @param stackTrace Stack trace. + * @param mtdName Method name. + */ + private static boolean isCalledFrom(StackTraceElement[] stackTrace, String mtdName) { + return Arrays.stream(stackTrace).map(StackTraceElement::getMethodName).anyMatch(mtdName::equals); + } + + /** + * @param gridIdx Grid index. + * @return Failure handler configured for grid with given index. + */ + private TestFailureHandler failureHandler(int gridIdx) { + FailureHandler hnd = grid(gridIdx).configuration().getFailureHandler(); + + assertTrue(hnd instanceof TestFailureHandler); + + return (TestFailureHandler)hnd; + } + + /** + * @param t Throwable. + */ + private void checkCause(Throwable t) { + StorageException e = X.cause(t, StorageException.class); + + assertNotNull(e); + assertNotNull(e.getMessage()); + assertTrue(e.getMessage().contains("Failed to format WAL segment file")); + + IOException ioe = X.cause(e, IOException.class); + + assertNotNull(ioe); + assertNotNull(ioe.getMessage()); + assertTrue(ioe.getMessage().contains("No space left on device")); + + assertTrue(isCalledFrom(ioe.getStackTrace(), formatFile)); + } + + /** */ + private void setFileIOFactory(IgniteWriteAheadLogManager wal) { + if (wal instanceof FileWriteAheadLogManager) + ((FileWriteAheadLogManager)wal).setFileIOFactory(new FailingFileIOFactory(failMtdNameRef)); + else + fail(wal.getClass().toString()); + } + + /** + * Create File I/O which fails if specific method call present in stack trace. + */ + private static class FailingFileIOFactory implements FileIOFactory { + /** Serial version uid. */ + private static final long serialVersionUID = 0L; + + /** Delegate factory. */ + private final FileIOFactory delegateFactory = new RandomAccessFileIOFactory(); + + /** Fail method name reference. */ + private final AtomicReference<String> failMtdNameRef; + + /** + * @param failMtdNameRef Fail method name reference. + */ + FailingFileIOFactory(AtomicReference<String> failMtdNameRef) { + assertNotNull(failMtdNameRef); + + this.failMtdNameRef = failMtdNameRef; + } + + /** {@inheritDoc} */ + @Override public FileIO create(File file, OpenOption... modes) throws IOException { + final FileIO delegate = delegateFactory.create(file, modes); + + return new FileIODecorator(delegate) { + @Override public int write(byte[] buf, int off, int len) throws IOException { + conditionalFail(); + + return super.write(buf, off, len); + } + + @Override public void clear() throws IOException { + conditionalFail(); + + super.clear(); + } + + private void conditionalFail() throws IOException { + String failMtdName = failMtdNameRef.get(); + + if (failMtdName != null && isCalledFrom(failMtdName)) + throw new IOException("No space left on device"); + } + }; + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java index 4c34093..8ac10b2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalHistoryReservationsTest.java @@ -40,12 +40,16 @@ import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.IgniteSystemProperties.IGNITE_PDS_WAL_REBALANCE_THRESHOLD; /** * */ +@RunWith(JUnit4.class) public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest { /** */ private volatile boolean client; @@ -106,6 +110,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testReservedOnExchange() throws Exception { System.setProperty(IGNITE_PDS_WAL_REBALANCE_THRESHOLD, "0"); @@ -251,6 +256,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testRemovesArePreloadedIfHistoryIsAvailable() throws Exception { int entryCnt = 10_000; @@ -300,6 +306,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testNodeIsClearedIfHistoryIsUnavailable() throws Exception { int entryCnt = 10_000; @@ -360,6 +367,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testWalHistoryPartiallyRemoved() throws Exception { int entryCnt = 10_000; @@ -399,6 +407,7 @@ public class IgniteWalHistoryReservationsTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + @Test public void testNodeLeftDuringExchange() throws Exception { System.setProperty(IGNITE_PDS_WAL_REBALANCE_THRESHOLD, "0"); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorExceptionDuringReadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorExceptionDuringReadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorExceptionDuringReadTest.java index ccd889a..9e01c78 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorExceptionDuringReadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorExceptionDuringReadTest.java @@ -39,10 +39,14 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * */ +@RunWith(JUnit4.class) public class IgniteWalIteratorExceptionDuringReadTest extends GridCommonAbstractTest { /** */ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); @@ -81,6 +85,7 @@ public class IgniteWalIteratorExceptionDuringReadTest extends GridCommonAbstract /** * @throws Exception If failed. */ + @Test public void test() throws Exception { IgniteEx ig = (IgniteEx)startGrid(); http://git-wip-us.apache.org/repos/asf/ignite/blob/f0544d46/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorSwitchSegmentTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorSwitchSegmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorSwitchSegmentTest.java index 0e147b7..001f77c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorSwitchSegmentTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalIteratorSwitchSegmentTest.java @@ -61,6 +61,9 @@ import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import static org.apache.ignite.internal.pagemem.wal.record.WALRecord.RecordType.METASTORE_DATA_RECORD; import static org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV1Serializer.HEADER_RECORD_SIZE; @@ -70,6 +73,7 @@ import static org.apache.ignite.testframework.GridTestUtils.waitForCondition; /*** * Test check correct switch segment if in the tail of segment have garbage. */ +@RunWith(JUnit4.class) public class IgniteWalIteratorSwitchSegmentTest extends GridCommonAbstractTest { /** Segment file size. */ private static final int SEGMENT_SIZE = 1024 * 1024; @@ -105,6 +109,7 @@ public class IgniteWalIteratorSwitchSegmentTest extends GridCommonAbstractTest { * * @throws Exception If some thing failed. */ + @Test public void testCheckSerializer() throws Exception { for (int serVer : checkSerializerVers) { checkInvariantSwitchSegmentSize(serVer); @@ -161,6 +166,7 @@ public class IgniteWalIteratorSwitchSegmentTest extends GridCommonAbstractTest { * * @throws Exception If some thing failed. */ + @Test public void testInvariantSwitchSegment() throws Exception { for (int serVer : checkSerializerVers) { try { @@ -177,6 +183,7 @@ public class IgniteWalIteratorSwitchSegmentTest extends GridCommonAbstractTest { * * @throws Exception If some thing failed. */ + @Test public void testSwitchReadingSegmentFromWorkToArchive() throws Exception { for (int serVer : checkSerializerVers) { try {
