Search in sources :

Example 6 with CacheFreeList

use of org.apache.ignite.internal.processors.cache.persistence.freelist.CacheFreeList in project ignite by apache.

the class CacheFreeListSelfTest method createFreeList.

/**
 * @param pageSize Page size.
 * @return Free list.
 * @throws Exception If failed.
 */
private FreeList<CacheDataRow> createFreeList(int pageSize) throws Exception {
    DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB).setMaxSize(1024 * MB);
    pageMem = createPageMemory(pageSize, plcCfg);
    long metaPageId = pageMem.allocatePage(1, 1, PageIdAllocator.FLAG_DATA);
    IgniteConfiguration cfg = new IgniteConfiguration().setMetricExporterSpi(new NoopMetricExporterSpi());
    GridTestKernalContext ctx = new GridTestKernalContext(new GridTestLog4jLogger(), cfg);
    ctx.add(new GridMetricManager(ctx));
    ctx.add(new PerformanceStatisticsProcessor(ctx));
    DataRegionMetricsImpl regionMetrics = new DataRegionMetricsImpl(plcCfg, ctx);
    DataRegion dataRegion = new DataRegion(pageMem, plcCfg, regionMetrics, new NoOpPageEvictionTracker());
    PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
    when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);
    return new CacheFreeList(1, "freelist", dataRegion, null, metaPageId, true, pageLockTrackerManager, new GridTestKernalContext(log), null, PageIdAllocator.FLAG_IDX);
}
Also used : GridTestKernalContext(org.apache.ignite.testframework.junits.GridTestKernalContext) CacheFreeList(org.apache.ignite.internal.processors.cache.persistence.freelist.CacheFreeList) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) PageLockTrackerManager(org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager) PerformanceStatisticsProcessor(org.apache.ignite.internal.processors.performancestatistics.PerformanceStatisticsProcessor) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) NoOpPageEvictionTracker(org.apache.ignite.internal.processors.cache.persistence.evict.NoOpPageEvictionTracker) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) NoopMetricExporterSpi(org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) GridTestLog4jLogger(org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger) DataRegion(org.apache.ignite.internal.processors.cache.persistence.DataRegion)

Aggregations

CacheFreeList (org.apache.ignite.internal.processors.cache.persistence.freelist.CacheFreeList)6 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)4 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 FailureContext (org.apache.ignite.failure.FailureContext)2 File (java.io.File)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Objects.isNull (java.util.Objects.isNull)1 Objects.nonNull (java.util.Objects.nonNull)1 Set (java.util.Set)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 Collectors (java.util.stream.Collectors)1 IntStream (java.util.stream.IntStream)1