use of org.apache.ignite.internal.pagememory.tree.io.BplusMetaIo in project ignite-3 by apache.
the class BplusTree method treeMeta.
/**
* Returns tree meta data.
*
* @param metaPageAddr Meta page address. If equals {@code 0}, it means that we should do read lock on meta page and get meta page
* address. Otherwise we will not do the lock and will use the given address.
* @throws IgniteInternalCheckedException If failed.
*/
private TreeMetaData treeMeta(final long metaPageAddr) throws IgniteInternalCheckedException {
TreeMetaData meta0 = treeMeta;
if (meta0 != null) {
return meta0;
}
final long metaPage = acquirePage(metaPageId);
try {
long pageAddr;
if (metaPageAddr == 0L) {
pageAddr = readLock(metaPageId, metaPage);
assert pageAddr != 0 : "Failed to read lock meta page [metaPageId=" + hexLong(metaPageId) + ']';
} else {
pageAddr = metaPageAddr;
}
try {
BplusMetaIo io = metaIos.forPage(pageAddr);
int rootLvl = io.getRootLevel(pageAddr);
long rootId = io.getFirstPageId(pageAddr, rootLvl);
treeMeta = meta0 = new TreeMetaData(rootLvl, rootId);
} finally {
if (metaPageAddr == 0L) {
readUnlock(metaPageId, metaPage, pageAddr);
}
}
} finally {
releasePage(metaPageId, metaPage);
}
return meta0;
}
use of org.apache.ignite.internal.pagememory.tree.io.BplusMetaIo in project ignite-3 by apache.
the class BplusTree method getFirstPageIds.
/**
* Returns first page IDs.
*
* @param pageAddr Meta page address.
*/
protected Iterable<Long> getFirstPageIds(long pageAddr) {
List<Long> res = new ArrayList<>();
BplusMetaIo mio = metaIos.forPage(pageAddr);
for (int lvl = mio.getRootLevel(pageAddr); lvl >= 0; lvl--) {
res.add(mio.getFirstPageId(pageAddr, lvl));
}
return res;
}
Aggregations