use of org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO in project ignite by apache.
the class MvccUtils method invoke.
/**
* Encapsulates common logic for working with row mvcc info: page locking/unlocking, checks and other.
* Strategy pattern.
*
* @param cctx Cache group.
* @param link Row link.
* @param clo Closure to apply.
* @param snapshot Mvcc snapshot.
* @param <R> Return type.
* @return Result.
* @throws IgniteCheckedException If failed.
*/
private static <R> R invoke(GridCacheContext cctx, long link, MvccClosure<R> clo, MvccSnapshot snapshot) throws IgniteCheckedException {
assert cctx.mvccEnabled();
PageMemory pageMem = cctx.dataRegion().pageMemory();
int grpId = cctx.groupId();
int pageSize = pageMem.realPageSize(grpId);
long pageId = pageId(link);
int itemId = itemId(link);
long page = pageMem.acquirePage(grpId, pageId);
try {
long pageAddr = pageMem.readLock(grpId, pageId, page);
try {
DataPageIO dataIo = DataPageIO.VERSIONS.forPage(pageAddr);
return invoke(cctx, dataIo, pageAddr, itemId, pageSize, clo, snapshot);
} finally {
pageMem.readUnlock(grpId, pageId, page);
}
} finally {
pageMem.releasePage(grpId, pageId, page);
}
}
Aggregations