use of org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress in project ignite by apache.
the class GridCacheDatabaseSharedManager method waitForCheckpoint.
/**
* {@inheritDoc}
*/
@Override
public <R> void waitForCheckpoint(String reason, IgniteInClosure<? super IgniteInternalFuture<R>> lsnr) throws IgniteCheckedException {
CheckpointProgress progress = checkpointManager.forceCheckpoint(reason, lsnr);
if (progress == null)
return;
progress.futureFor(FINISHED).get();
}
use of org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress in project ignite by apache.
the class IgnitePageMemReplaceDelayedWriteUnitTest method createPageMemory.
/**
* @param cfg configuration
* @param pageWriter writer for page replacement.
* @param pageSize page size
* @return implementation for test
*/
@NotNull
private PageMemoryImpl createPageMemory(IgniteConfiguration cfg, PageStoreWriter pageWriter, int pageSize) {
IgniteCacheDatabaseSharedManager db = mock(GridCacheDatabaseSharedManager.class);
when(db.checkpointLockIsHeldByThread()).thenReturn(true);
GridCacheSharedContext sctx = Mockito.mock(GridCacheSharedContext.class);
when(sctx.gridConfig()).thenReturn(cfg);
when(sctx.pageStore()).thenReturn(new NoOpPageStoreManager());
when(sctx.wal()).thenReturn(new NoOpWALManager());
when(sctx.database()).thenReturn(db);
when(sctx.logger(any(Class.class))).thenReturn(log);
GridKernalContext kernalCtx = mock(GridKernalContext.class);
when(kernalCtx.config()).thenReturn(cfg);
when(kernalCtx.log(any(Class.class))).thenReturn(log);
when(kernalCtx.internalSubscriptionProcessor()).thenAnswer(mock -> new GridInternalSubscriptionProcessor(kernalCtx));
when(kernalCtx.encryption()).thenAnswer(mock -> new GridEncryptionManager(kernalCtx));
when(kernalCtx.metric()).thenAnswer(mock -> new GridMetricManager(kernalCtx));
when(kernalCtx.performanceStatistics()).thenAnswer(mock -> new PerformanceStatisticsProcessor(kernalCtx));
when(sctx.kernalContext()).thenReturn(kernalCtx);
when(sctx.gridEvents()).thenAnswer(invocationOnMock -> new GridEventStorageManager(kernalCtx));
DataRegionConfiguration regCfg = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration();
DataRegionMetricsImpl memMetrics = new DataRegionMetricsImpl(regCfg, kernalCtx);
long[] sizes = prepareSegmentSizes(regCfg.getMaxSize());
DirectMemoryProvider provider = new UnsafeMemoryProvider(log);
IgniteOutClosure<CheckpointProgress> clo = () -> Mockito.mock(CheckpointProgressImpl.class);
PageMemoryImpl memory = new PageMemoryImpl(provider, sizes, sctx, sctx.pageStore(), pageSize, pageWriter, null, () -> true, memMetrics, PageMemoryImpl.ThrottlingPolicy.DISABLED, clo);
memory.start();
return memory;
}
Aggregations