use of org.apache.derby.iapi.store.raw.FetchDescriptor in project derby by apache.
the class LeafControlRow method allocate.
/* Private/Protected methods of This class: */
/**
* Allocate a new leaf page to the conglomerate.
*
* @param btree The open conglomerate from which to get the leaf from
* @param parent The parent page of the newly allocated page, null if
* allocating root page.
*
* @exception StandardException Standard exception policy.
*/
private static LeafControlRow allocate(OpenBTree btree, ControlRow parent) throws StandardException {
Page page = btree.container.addPage();
// Create a control row for the new page.
LeafControlRow control_row = new LeafControlRow(btree, page, parent, false);
// Insert the control row on the page, in the first slot on the page.
// This operation is only done as part of a new tree or split, which
// which both will be undone physically so no logical undo record is
// needed.
byte insertFlag = Page.INSERT_INITIAL;
insertFlag |= Page.INSERT_DEFAULT;
RecordHandle rh = page.insertAtSlot(Page.FIRST_SLOT_NUMBER, control_row.getRow(), (FormatableBitSet) null, (LogicalUndo) null, insertFlag, AccessFactoryGlobals.BTREE_OVERFLOW_THRESHOLD);
if (SanityManager.DEBUG) {
RecordHandle rh2 = null;
rh2 = page.fetchFromSlot((RecordHandle) null, page.FIRST_SLOT_NUMBER, new DataValueDescriptor[0], (FetchDescriptor) null, true);
SanityManager.ASSERT(rh.getId() == rh2.getId() && rh.getPageNumber() == rh2.getPageNumber());
}
// Page is returned latched.
return (control_row);
}
Aggregations