use of org.apache.ignite.internal.processors.cache.tree.PendingEntriesTree in project ignite by apache.
the class UpgradePendingTreeToPerPartitionTask method processCacheGroup.
/**
* Converts CacheGroup pending tree to per-partition basis.
*
* @param grp Cache group.
* @throws IgniteCheckedException If error occurs.
*/
private void processCacheGroup(CacheGroupContext grp) throws IgniteCheckedException {
assert grp.offheap() instanceof GridCacheOffheapManager;
PendingEntriesTree oldPendingTree;
final IgniteCacheDatabaseSharedManager db = grp.shared().database();
db.checkpointReadLock();
try {
IndexStorage indexStorage = ((GridCacheOffheapManager) grp.offheap()).getIndexStorage();
// TODO: IGNITE-5874: replace with some check-method to avoid unnecessary page allocation.
RootPage pendingRootPage = indexStorage.allocateIndex(PENDING_ENTRIES_TREE_NAME);
if (pendingRootPage.isAllocated()) {
log.info("No pending tree found for cache group: [grpId=" + grp.groupId() + ", grpName=" + grp.name() + ']');
// Nothing to do here as just allocated tree is obviously empty.
indexStorage.dropIndex(PENDING_ENTRIES_TREE_NAME);
return;
}
oldPendingTree = new PendingEntriesTree(grp, PENDING_ENTRIES_TREE_NAME, grp.dataRegion().pageMemory(), pendingRootPage.pageId().pageId(), ((GridCacheOffheapManager) grp.offheap()).reuseListForIndex(null), false, grp.shared().diagnostic().pageLockTracker(), PageIdAllocator.FLAG_IDX);
} finally {
db.checkpointReadUnlock();
}
processPendingTree(grp, oldPendingTree);
if (Thread.currentThread().isInterrupted())
return;
db.checkpointReadLock();
try {
oldPendingTree.destroy();
} finally {
db.checkpointReadUnlock();
}
}
Aggregations