use of org.apache.ignite.internal.pagemem.FullPageId 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();
}
}
Aggregations