Search in sources :

Example 11 with CheckpointProgress

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();
}
Also used : CheckpointProgress(org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress)

Example 12 with CheckpointProgress

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;
}
Also used : GridEventStorageManager(org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager) GridEncryptionManager(org.apache.ignite.internal.managers.encryption.GridEncryptionManager) CheckpointProgress(org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress) GridInternalSubscriptionProcessor(org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor) GridKernalContext(org.apache.ignite.internal.GridKernalContext) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) PerformanceStatisticsProcessor(org.apache.ignite.internal.processors.performancestatistics.PerformanceStatisticsProcessor) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

CheckpointProgress (org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress)12 GridEncryptionManager (org.apache.ignite.internal.managers.encryption.GridEncryptionManager)6 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)6 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)6 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)6 IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)6 GridMetricManager (org.apache.ignite.internal.processors.metric.GridMetricManager)6 PerformanceStatisticsProcessor (org.apache.ignite.internal.processors.performancestatistics.PerformanceStatisticsProcessor)6 GridInternalSubscriptionProcessor (org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor)6 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)5 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)5 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)5 GridSystemViewManager (org.apache.ignite.internal.managers.systemview.GridSystemViewManager)5 JmxSystemViewExporterSpi (org.apache.ignite.internal.managers.systemview.JmxSystemViewExporterSpi)5 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 IgnitePluginProcessor (org.apache.ignite.internal.processors.plugin.IgnitePluginProcessor)5 NoopEncryptionSpi (org.apache.ignite.spi.encryption.noop.NoopEncryptionSpi)5 NoopMetricExporterSpi (org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi)5 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4