Package org.apache.derby.iapi.store.raw

Examples of org.apache.derby.iapi.store.raw.Page


    // create the first alloc page and the first user page,
    // if this fails for any reason the transaction
    // will roll back and the container will be dropped (removed)
    ContainerHandle containerHdl = null;
    Page            firstPage    = null;

    try
        {
      // if opening a temporary container with IS_KEPT flag set,
      // make sure to open it with IS_KEPT too.
      if (tmpContainer &&
        ((temporaryFlag & TransactionController.IS_KEPT) ==
                     TransactionController.IS_KEPT))
            {

        mode |= ContainerHandle.MODE_TEMP_IS_KEPT;
      }

      // open no-locking as we already have the container locked
      containerHdl =
                t.openContainer(
                    identity, null, (ContainerHandle.MODE_FORUPDATE | mode));

      // we just added it, containerHdl should not be null
            if (SanityManager.DEBUG)
                SanityManager.ASSERT(containerHdl != null);

      if (!tmpContainer)
            {
        // make it persistent (in concept if not in reality)
        RawContainerHandle rch = (RawContainerHandle)containerHdl;

        ContainerOperation lop =
          new ContainerOperation(rch, ContainerOperation.CREATE);

        // mark the container as pre-dirtied so that if a checkpoint
        // happens after the log record is sent to the log stream, the
        // cache cleaning will wait for this change.
        rch.preDirty(true);
        try
        {
          t.logAndDo(lop);

          // flush the log to reduce the window between where
          // the container is created & synced and the log record
          // for it makes it to disk. If we fail in this
          // window we will leave a stranded container file.
          flush(t.getLastLogInstant());
        }
        finally
        {
          // in case logAndDo fail, make sure the container is not
          // stuck in preDirty state.
          rch.preDirty(false);
        }
      }

      firstPage = containerHdl.addPage();

    }
        finally
        {

      if (firstPage != null)
            {
        firstPage.unlatch();
        firstPage = null;
      }
     
      containerCache.release(container);
View Full Code Here


            lastInsertedPage = new long[4];
            lastInsertedPage[0] = last;

            for (int i = 3; i > 0; i--)
            {
                Page page = addPage(handle, false);
                lastInsertedPage[i] = page.getPageNumber();
                page.unlatch();
            }
        }
    }
View Full Code Here

  */
  public Page addPage() throws StandardException
    {
    checkUpdateOpen();

    Page page = container.addPage(this, false /* not an overflow page */);
     
    return page;
  }
View Full Code Here

                // Remember the time stamp on the first page of the column
                // chain.  This is to prevent the case where the post commit
                // work gets fired twice, in that case, the second time it is
                // fired, this overflow page may not part of this row chain
                // that is being updated.
                Page firstPageOnColumnChain = getOverflowPage(overflowPage);
                PageTimeStamp ts = firstPageOnColumnChain.currentTimeStamp();
                firstPageOnColumnChain.unlatch();

                RawTransaction rxact = (RawTransaction)owner.getTransaction();

                ReclaimSpace work =
                    new ReclaimSpace(ReclaimSpace.COLUMN_CHAIN,
View Full Code Here

    ControlRow        leftchild,
    int               level,
    ControlRow        parent)
        throws StandardException
    {
        Page      page      = open_btree.container.addPage();

        // Create a control row for the new page.
        BranchControlRow control_row =
            new BranchControlRow(
                open_btree, page, level,
                parent, false, leftchild.page.getPageNumber());

        // Insert the control row on the page.
    byte insertFlag = Page.INSERT_INITIAL;
    insertFlag |= Page.INSERT_DEFAULT;
        page.insertAtSlot(
            Page.FIRST_SLOT_NUMBER,
            control_row.getRow(),
            (FormatableBitSet) null,
            (LogicalUndo)null,
            insertFlag, AccessFactoryGlobals.BTREE_OVERFLOW_THRESHOLD);
View Full Code Here

            // the post commit work will just skip it.
            control_row = ControlRow.getNoWait(open_btree, pageno);

            if (control_row != null)
            {
                Page page   = control_row.page;

                // The number records that can be reclaimed is:
                // total recs - control row - recs_not_deleted
                int num_possible_commit_delete =
                    page.recordCount() - 1 - page.nonDeletedRecordCount();

                if (num_possible_commit_delete > 0)
                {
                    // loop backward so that purges which affect the slot table
                    // don't affect the loop (ie. they only move records we
                    // have already looked at).
                    for (int slot_no = page.recordCount() - 1;
                         slot_no > 0;
                         slot_no--)
                    {
                        if (page.isDeletedAtSlot(slot_no))
                        {

                            if (page.recordCount() == 2)
                            {
                                // About to purge last row from page so
                                // remember the key so we can shrink the
                                // tree.
                                shrink_key = this.getShrinkKey(
                                    open_btree, control_row, slot_no);
                            }

                            page.purgeAtSlot(slot_no, 1, true);
                            // Tell scans positioned on this page to reposition
                            // because the row they are positioned on may have
                            // disappeared.
                            page.setRepositionNeeded();

                            if (SanityManager.DEBUG)
                            {
                                if (SanityManager.DEBUG_ON(
                                        "verbose_btree_post_commit"))
                                {
                                    System.out.println(
                                        "Purging row[" + slot_no + "]" +
                                        "on page:" + pageno + ".\n");
                                }
                            }
                        }
                    }
                }

                if (page.recordCount() == 1)
                {
                    if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON("verbose_btree_post_commit"))
                        {
View Full Code Here

        {
            DataValueDescriptor[] scratch_template =
                open_btree.getRuntimeMem().get_template(
                    open_btree.getRawTran());

            Page page   = leaf.page;


            // RowLocation column is in last column of template.
            FetchDescriptor lock_fetch_desc =
                RowUtil.getFetchDescriptorConstant(
                    scratch_template.length - 1);

            // loop backward so that purges which affect the slot table
            // don't affect the loop (ie. they only move records we
            // have already looked at).
            for (int slot_no = page.recordCount() - 1;
                 slot_no > 0;
                 slot_no--)
            {
                if (page.isDeletedAtSlot(slot_no))
                {
                    // try to get an exclusive lock on the row, if we can
                    // then the row is a committed deleted row and it is
                    // safe to purge it.
                    if (btree_locking_policy.lockScanCommittedDeletedRow(
                            open_btree, leaf, scratch_template,
                            lock_fetch_desc, slot_no))
                    {
                        // the row is a committed deleted row, purge it.
                        page.purgeAtSlot(slot_no, 1, true);
                        // Tell scans positioned on this page to reposition
                        // because the row they are positioned on may have
                        // disappeared.
                        page.setRepositionNeeded();
                    }
                }
            }

        }
View Full Code Here

    Properties  prop,
    LevelInfo   level_info[])
        throws StandardException
    {
        LevelInfo li    = level_info[control_row.getLevel()];
        Page      page  = control_row.page;



        li.num_pages++;
        li.num_entries += (page.recordCount() - 1);
        li.num_deleted += (page.recordCount() - page.nonDeletedRecordCount());
        li.max_pageno  = Math.max(li.max_pageno, page.getPageNumber());

        DiagnosticUtil.findDiagnostic(page).diag_detail(prop);


        DiagnosticUtil.findDiagnostic(page).diag_detail(prop);
View Full Code Here

    {
        ControlRow            root                      = null;
        ControlRow            control_row               = null;
        DataValueDescriptor[] logged_index_row_template = null;
        DataValueDescriptor[] template                  = null;
        Page                  ret_page                  = null;
        ContainerHandle       container                 = pageOp.getContainer();
        RecordHandle          rechandle                 = pageOp.getRecordHandle();
        boolean               ok_exit                   = false;
        int                   compare_result            = 1;
        B2I                   btree                     = null;
View Full Code Here

            // Reposition to remembered spot on page.

            // Get the page object. If getPage() returns null, the page is
            // not valid (could for instance have been removed by compress
            // table) so we need to reposition by key instead.
            Page page = container.getPage(pos.current_rh.getPageNumber());
            if (page != null) {
                ControlRow row =
                        ControlRow.getControlRowForPage(container, page);
                if (row instanceof LeafControlRow &&
                        !row.page.isRepositionNeeded(pos.versionWhenSaved)) {
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.store.raw.Page

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.