use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.
the class PageMemoryNoLoadSelfTest method testLoadedPagesCount.
/**
* @throws Exception If failed.
*/
public void testLoadedPagesCount() throws Exception {
PageMemory mem = memory();
mem.start();
int expPages = MAX_MEMORY_SIZE / mem.systemPageSize();
try {
for (int i = 0; i < expPages * 2; i++) allocatePage(mem);
} catch (IgniteOutOfMemoryException e) {
e.printStackTrace();
// Expected.
assertEquals(mem.loadedPages(), expPages);
} finally {
mem.stop();
}
}
use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.
the class PageMemoryNoLoadSelfTest method testPageTearingInner.
/**
* @throws Exception If failed.
*/
public void testPageTearingInner() throws Exception {
PageMemory mem = memory();
mem.start();
try {
FullPageId fullId1 = allocatePage(mem);
FullPageId fullId2 = allocatePage(mem);
long page1 = mem.acquirePage(fullId1.cacheId(), fullId1.pageId());
try {
long page2 = mem.acquirePage(fullId2.cacheId(), fullId2.pageId());
info("Allocated pages [page1Id=" + fullId1.pageId() + ", page1=" + page1 + ", page2Id=" + fullId2.pageId() + ", page2=" + page2 + ']');
try {
writePage(mem, fullId1.pageId(), page1, 1);
writePage(mem, fullId2.pageId(), page2, 2);
readPage(mem, fullId1.pageId(), page1, 1);
readPage(mem, fullId2.pageId(), page2, 2);
// Check read after read.
readPage(mem, fullId1.pageId(), page1, 1);
readPage(mem, fullId2.pageId(), page2, 2);
} finally {
mem.releasePage(fullId2.cacheId(), fullId2.pageId(), page2);
}
} finally {
mem.releasePage(fullId1.cacheId(), fullId1.pageId(), page1);
}
} finally {
mem.stop();
}
}
use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.
the class BPlusTreeSelfTest method createPageMemory.
/**
* @return Page memory.
*/
protected PageMemory createPageMemory() throws Exception {
MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log, new UnsafeMemoryProvider(log), null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
pageMem.start();
return pageMem;
}
use of org.apache.ignite.internal.pagemem.PageMemory in project ignite by apache.
the class FreeListImplSelfTest method createPageMemory.
/**
* @return Page memory.
*/
protected PageMemory createPageMemory(int pageSize, MemoryPolicyConfiguration plcCfg) throws Exception {
PageMemory pageMem = new PageMemoryNoStoreImpl(log, new UnsafeMemoryProvider(log), null, pageSize, plcCfg, new MemoryMetricsImpl(plcCfg), true);
pageMem.start();
return pageMem;
}
Aggregations