Search in sources :

Example 1 with DFLT_WAL_PATH

use of org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH in project ignite by apache.

the class WalArchiveConsistencyTest method checkRecoveryWithoutWalTruncate.

/**
 * Checking the consistency of recovery from a WAL when switching
 * WAL archive off -> on and changing the number of segments on node restart.
 * Without truncate WAL segments.
 *
 * @param segments Segment count on node restart.
 * @throws Exception If failed.
 */
private void checkRecoveryWithoutWalTruncate(int segments) throws Exception {
    IgniteEx n = startGrid(0, cfg -> {
        cfg.getDataStorageConfiguration().setWalArchivePath(DFLT_WAL_PATH);
    });
    // Protection against deleting WAL segments.
    assertTrue(walMgr(n).reserve(new WALPointer(0, 0, 0)));
    AtomicInteger key = new AtomicInteger();
    fill(n, 3, key);
    forceCheckpoint();
    // Guaranteed recovery from WAL segments.
    dbMgr(n).enableCheckpoints(false).get(getTestTimeout());
    fill(n, 3, key);
    stopAllGrids();
    n = startGrid(0, cfg -> {
        cfg.getDataStorageConfiguration().setWalSegments(segments);
    });
    assertEquals(key.get(), n.cache(DEFAULT_CACHE_NAME).size());
}
Also used : WALMode(org.apache.ignite.configuration.WALMode) Arrays(java.util.Arrays) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Collection(java.util.Collection) GridTestUtils.waitForCondition(org.apache.ignite.testframework.GridTestUtils.waitForCondition) ClusterState(org.apache.ignite.cluster.ClusterState) RunWith(org.junit.runner.RunWith) U(org.apache.ignite.internal.util.typedef.internal.U) IgniteEx(org.apache.ignite.internal.IgniteEx) Test(org.junit.Test) Consumer(java.util.function.Consumer) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) Parameterized(org.junit.runners.Parameterized) DFLT_WAL_PATH(org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IgniteEx(org.apache.ignite.internal.IgniteEx)

Aggregations

Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Consumer (java.util.function.Consumer)1 ClusterState (org.apache.ignite.cluster.ClusterState)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)1 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)1 DFLT_WAL_PATH (org.apache.ignite.configuration.DataStorageConfiguration.DFLT_WAL_PATH)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 WALMode (org.apache.ignite.configuration.WALMode)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 U (org.apache.ignite.internal.util.typedef.internal.U)1 GridTestUtils.waitForCondition (org.apache.ignite.testframework.GridTestUtils.waitForCondition)1 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 Parameterized (org.junit.runners.Parameterized)1