use of org.apache.ignite.internal.pagememory.FullPageId in project ignite-3 by apache.
the class ClockPageReplacementPolicy method replace.
/**
* {@inheritDoc}
*/
@Override
public long replace() throws IgniteInternalCheckedException {
LoadedPagesMap loadedPages = seg.loadedPages();
for (int i = 0; i < loadedPages.size(); i++) {
int pageIdx = flags.poll();
long relPtr = seg.relative(pageIdx);
long absPtr = seg.absolute(relPtr);
FullPageId fullId = fullPageId(absPtr);
// Check loaded pages map for outdated page.
relPtr = loadedPages.get(fullId.groupId(), fullId.effectivePageId(), seg.partGeneration(fullId.groupId(), partitionId(fullId.pageId())), INVALID_REL_PTR, OUTDATED_REL_PTR);
assert relPtr != INVALID_REL_PTR;
if (relPtr == OUTDATED_REL_PTR) {
return seg.refreshOutdatedPage(fullId.groupId(), fullId.pageId(), true);
}
if (seg.tryToRemovePage(fullId, absPtr)) {
return relPtr;
}
flags.setFlag(pageIdx);
}
throw seg.oomException("no pages to replace");
}
Aggregations