use of org.apache.ignite.internal.mem.file.MappedFileMemoryProvider in project ignite by apache.
the class MetadataStorageSelfTest method memory.
/**
* @param clean Clean flag. If {@code true}, will clean previous memory state and allocate
* new empty page memory.
* @return Page memory instance.
*/
protected PageMemory memory(boolean clean) throws Exception {
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
return new PageMemoryNoStoreImpl(log, provider, null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
}
use of org.apache.ignite.internal.mem.file.MappedFileMemoryProvider in project ignite by apache.
the class PageMemoryNoLoadSelfTest method memory.
/**
* @return Page memory implementation.
* @throws Exception If failed.
*/
protected PageMemory memory() throws Exception {
File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
DataRegionConfiguration plcCfg = new DataRegionConfiguration().setMaxSize(MAX_MEMORY_SIZE).setInitialSize(MAX_MEMORY_SIZE);
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
return new PageMemoryNoStoreImpl(log(), provider, null, PAGE_SIZE, plcCfg, new DataRegionMetricsImpl(plcCfg), true);
}
use of org.apache.ignite.internal.mem.file.MappedFileMemoryProvider in project ignite by apache.
the class IndexStoragePageMemoryImplTest method memory.
/**
* @param clean Clean flag. If {@code true}, will clean previous memory state and allocate
* new empty page memory.
* @return Page memory instance.
*/
@Override
protected PageMemory memory(boolean clean) throws Exception {
long[] sizes = new long[10];
for (int i = 0; i < sizes.length; i++) sizes[i] = 1024 * 1024;
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
GridCacheSharedContext<Object, Object> sharedCtx = new GridCacheSharedContext<>(new GridTestKernalContext(log), null, null, null, new NoOpPageStoreManager(), new NoOpWALManager(), null, new IgniteCacheDatabaseSharedManager(), null, null, null, null, null, null, null, null);
return new PageMemoryImpl(provider, sizes, sharedCtx, PAGE_SIZE, (fullPageId, byteBuf, tag) -> {
assert false : "No page replacement (rotation with disk) should happen during the test";
}, new GridInClosure3X<Long, FullPageId, PageMemoryEx>() {
@Override
public void applyx(Long page, FullPageId fullId, PageMemoryEx pageMem) {
}
}, () -> true, new DataRegionMetricsImpl(new DataRegionConfiguration()), PageMemoryImpl.ThrottlingPolicy.DISABLED, null);
}
use of org.apache.ignite.internal.mem.file.MappedFileMemoryProvider in project ignite by apache.
the class PageMemoryImplNoLoadTest method memory.
/**
* @return Page memory implementation.
*/
@Override
protected PageMemory memory() throws Exception {
File memDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), "pagemem", false);
long[] sizes = new long[10];
for (int i = 0; i < sizes.length; i++) sizes[i] = 5 * 1024 * 1024;
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), memDir);
GridCacheSharedContext<Object, Object> sharedCtx = new GridCacheSharedContext<>(new GridTestKernalContext(log), null, null, null, new NoOpPageStoreManager(), new NoOpWALManager(), null, new IgniteCacheDatabaseSharedManager(), null, null, null, null, null, null, null, null);
return new PageMemoryImpl(provider, sizes, sharedCtx, PAGE_SIZE, (fullPageId, byteBuf, tag) -> {
assert false : "No page replacement (rotation with disk) should happen during the test";
}, new GridInClosure3X<Long, FullPageId, PageMemoryEx>() {
@Override
public void applyx(Long page, FullPageId fullId, PageMemoryEx pageMem) {
}
}, new CheckpointLockStateChecker() {
@Override
public boolean checkpointLockIsHeldByThread() {
return true;
}
}, new DataRegionMetricsImpl(new DataRegionConfiguration()), PageMemoryImpl.ThrottlingPolicy.DISABLED, null);
}
use of org.apache.ignite.internal.mem.file.MappedFileMemoryProvider in project ignite by apache.
the class IgniteCacheDatabaseSharedManager method initMemory.
/**
* @param memCfg memory configuration with common parameters.
* @param plcCfg memory policy with PageMemory specific parameters.
* @param memMetrics {@link MemoryMetrics} object to collect memory usage metrics.
* @return Memory policy instance.
*/
private MemoryPolicy initMemory(MemoryConfiguration memCfg, MemoryPolicyConfiguration plcCfg, MemoryMetricsImpl memMetrics) {
File allocPath = buildAllocPath(plcCfg);
DirectMemoryProvider memProvider = allocPath == null ? new UnsafeMemoryProvider(log) : new MappedFileMemoryProvider(log, allocPath);
PageMemory pageMem = createPageMemory(memProvider, memCfg, plcCfg, memMetrics);
return new MemoryPolicy(pageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, pageMem));
}
Aggregations