cachePointer.decrementReferrer();
}
}
private void assertChangesTracking(OClusterPage localPage, ODirectMemoryPointer pagePointer) throws IOException {
ODirectMemoryPointer restoredPagePointer = new ODirectMemoryPointer(new byte[OClusterPage.PAGE_SIZE + ODurablePage.PAGE_PADDING]);
OCachePointer cachePointer = new OCachePointer(restoredPagePointer, new OLogSequenceNumber(0, 0));
cachePointer.incrementReferrer();
OCacheEntry cacheEntry = new OCacheEntry(0, 0, cachePointer, false);
try {
OClusterPage restoredPage = new OClusterPage(cacheEntry, false, ODurablePage.TrackMode.FULL);
OPageChanges changes = localPage.getPageChanges();
restoredPage.restoreChanges(changes);
Assert.assertEquals(restoredPagePointer.get(SYSTEM_OFFSET, OClusterPage.PAGE_SIZE - SYSTEM_OFFSET),
pagePointer.get(SYSTEM_OFFSET, OClusterPage.PAGE_SIZE - SYSTEM_OFFSET));
restoredPage.revertChanges(changes);
Assert.assertEquals(restoredPagePointer.get(SYSTEM_OFFSET, OClusterPage.PAGE_SIZE - SYSTEM_OFFSET),
new byte[OClusterPage.PAGE_SIZE - SYSTEM_OFFSET]);
} finally {
cachePointer.decrementReferrer();
}
}