return "page[" + getPos() + "] data node table:" + index.getId() +
" entries:" + entryCount + " " + Arrays.toString(childPageIds);
}
public void moveTo(Session session, int newPos) {
PageStore store = index.getPageStore();
// load the pages into the cache, to ensure old pages
// are written
for (int i = 0; i < entryCount + 1; i++) {
int child = childPageIds[i];
store.getPage(child);
}
if (parentPageId != ROOT) {
store.getPage(parentPageId);
}
store.logUndo(this, data);
PageDataNode p2 = PageDataNode.create(index, newPos, parentPageId);
p2.rowCountStored = rowCountStored;
p2.rowCount = rowCount;
p2.childPageIds = childPageIds;
p2.keys = keys;
p2.entryCount = entryCount;
p2.length = length;
store.update(p2);
if (parentPageId == ROOT) {
index.setRootPageId(session, newPos);
} else {
PageDataNode p = (PageDataNode) store.getPage(parentPageId);
p.moveChild(getPos(), newPos);
}
for (int i = 0; i < entryCount + 1; i++) {
int child = childPageIds[i];
PageData p = (PageData) store.getPage(child);
p.setParentPageId(newPos);
store.update(p);
}
store.free(getPos());
}