Index Split stops right after restarting to split the parent node
-----------------------------------------------------------------
Key: DERBY-3022
URL: https://issues.apache.org/jira/browse/DERBY-3022
Project: Derby
Issue Type: Bug
Components: Store
Affects Versions: 10.3.1.4
Environment: windows
Reporter: Kangmo Kim
Whle I was analyzing source code, I found that
at org.apache.derby.impl.store.access.btree.BranchControlRow
splitFor method tries to split the branch node.
But, as soon as it finds that the parent node does not have enough space to
insert
the split branch row (the mid row in the page to be splitted),
it calls restartSplitFor to restart split...
// At this point we have guaranteed there is space in the parent
// page for splitrow, but it could be the case that the new
// "newbranchrow" does not fit on the parent page.
if (!parent.page.spaceForInsert(
newbranchrow.getRow(), (FormatableBitSet) null,
AccessFactoryGlobals.BTREE_OVERFLOW_THRESHOLD))
{
// There is no room on the parent page to complete a split at
// the current level, so restart the split at top with the
// branchrow that did not fit. On return from this routine
// there is no way to know the state of the tree, so the
// current split pass recursion must end.
return(
parent.restartSplitFor(
open_btree, template, parent, this,
newbranchrow.getRow(), splitrow, flag));
}
Right before following the code, what I guessed was that
restartSplitFor would insert newbranchrow into parent, and continue to split
nodes to reserve space insert splitrow at leaf node of b-tree.
public static long restartSplitFor(
OpenBTree open_btree,
DataValueDescriptor[] template,
BranchControlRow parent,
ControlRow child,
DataValueDescriptor[] newbranchrow,
DataValueDescriptor[] splitrow,
int flag)
throws StandardException
{
// release parent and current latch
parent.release();
child.release();
parent = null;
child = null;
// Get the root page back, and perform a split following the
// branch row which would not fit.
ControlRow root = ControlRow.get(open_btree, BTree.ROOTPAGEID);
if (SanityManager.DEBUG)
SanityManager.ASSERT(root.page.isLatched());
return(root.splitFor(open_btree, template, null, newbranchrow, flag));
}
But what I found was...
It just inserts the split branch row into the parent,
and ends...
restartSplitFor should continue to split nodes to reserve space to insert
splitrow at leaf level.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.