Search in sources :

Example 16 with FetchDescriptor

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);
}
Also used : RecordHandle(org.apache.derby.iapi.store.raw.RecordHandle) FetchDescriptor(org.apache.derby.iapi.store.raw.FetchDescriptor) Page(org.apache.derby.iapi.store.raw.Page) DataValueDescriptor(org.apache.derby.iapi.types.DataValueDescriptor)

Aggregations

FetchDescriptor (org.apache.derby.iapi.store.raw.FetchDescriptor)16 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)9 Page (org.apache.derby.iapi.store.raw.Page)5 Qualifier (org.apache.derby.iapi.store.access.Qualifier)4 RecordHandle (org.apache.derby.iapi.store.raw.RecordHandle)4 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)3 AuxObject (org.apache.derby.iapi.store.raw.AuxObject)2 RowLocation (org.apache.derby.iapi.types.RowLocation)2 CounterOutputStream (org.apache.derby.iapi.services.io.CounterOutputStream)1 NullOutputStream (org.apache.derby.iapi.services.io.NullOutputStream)1 SQLLongint (org.apache.derby.iapi.types.SQLLongint)1 StorableFormatId (org.apache.derby.impl.store.access.StorableFormatId)1 StandardException (org.apache.derby.shared.common.error.StandardException)1