Search in sources :

Example 1 with Checkpointer

use of org.apache.ignite.internal.processors.cache.persistence.checkpoint.Checkpointer in project ignite by apache.

the class WalDeletionArchiveAbstractTest method testCheckpointStarted_WhenWalHasTooBigSizeWithoutCheckpoint.

/**
 * Checkpoint triggered depends on wal size.
 */
@Test
public void testCheckpointStarted_WhenWalHasTooBigSizeWithoutCheckpoint() throws Exception {
    // given: configured grid with max wal archive size = 1MB, wal segment size = 512KB
    Ignite ignite = startGrid(dbCfg -> dbCfg.setMaxWalArchiveSize(1024 * 1024));
    GridCacheDatabaseSharedManager dbMgr = gridDatabase(ignite);
    IgniteCache<Integer, Object> cache = ignite.getOrCreateCache(cacheConfiguration());
    for (int i = 0; i < 500; i++) cache.put(i, i);
    // then: checkpoint triggered by size limit of wall without checkpoint
    Checkpointer checkpointer = dbMgr.getCheckpointer();
    String checkpointReason = U.field((Object) U.field(checkpointer, "curCpProgress"), "reason");
    assertEquals("too big size of WAL without checkpoint", checkpointReason);
}
Also used : Checkpointer(org.apache.ignite.internal.processors.cache.persistence.checkpoint.Checkpointer) GridCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager) Ignite(org.apache.ignite.Ignite) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

Ignite (org.apache.ignite.Ignite)1 GridCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager)1 Checkpointer (org.apache.ignite.internal.processors.cache.persistence.checkpoint.Checkpointer)1 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 Test (org.junit.Test)1