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

Examples of org.apache.derby.iapi.store.raw.xact.RawTransaction


    <BR>
    MT - thread safe
  */
  boolean setExclusiveNoWait(BaseContainerHandle requester) throws StandardException {

    RawTransaction t = requester.getTransaction();

    // comment in setExclusive()
    synchronized (this)
    {
      if ((owner != null) && (t == owner.getTransaction())) {

        if (t.inAbort()) {
          //
          nestedLatch++;
          return true;
        }
      }
      // just deadlock out ...
    }

    // Latch the page, owner is set through the Lockable call backs.
    boolean gotLatch = t.getLockFactory().latchObject(t, this, requester, C_LockFactory.NO_WAIT);
    if (!gotLatch)
      return false;

        synchronized (this)
        {
View Full Code Here


    if (nestedLatch > 0) {
      nestedLatch--;
      return;
    }

    RawTransaction t = owner.getTransaction();
    t.getLockFactory().unlatch(myLatch);
  }
View Full Code Here

        {
      throw StandardException.newException(
                    SQLState.DATA_CONTAINER_READ_ONLY);
        }

    RawTransaction t = owner.getTransaction();

    owner.getActionSet().actionInvalidatePage(t, this);
  }
View Full Code Here

        {
      throw StandardException.newException(
                    SQLState.DATA_CONTAINER_READ_ONLY);
        }

    RawTransaction t = owner.getTransaction();

    owner.getActionSet().actionInitPage(
      t, this, initFlag, getTypeFormatId(), pageOffset);
  }
View Full Code Here

        {
      throw StandardException.newException(
                    SQLState.DATA_SLOT_NOT_ON_PAGE);
        }

    RawTransaction t = owner.getTransaction();

    // get num_rows row locks, need to predict what those recordIds will be

    int[] recordIds = new int[num_rows];
View Full Code Here

  protected RawContainerHandle findContainer(Transaction tran)
     throws StandardException
  {
    releaseResource(tran);

    RawTransaction rtran = (RawTransaction)tran;
    containerHdl = rtran.openDroppedContainer(
      containerId, (LockingPolicy) null);

    //If we are in roll forward recovery, missing container will be
    //recreated becuase we might have hit a log record which has a
    //reused the container id that was dropped earlier.
    if (rtran.inRollForwardRecovery())
    {
      if (containerHdl == null)
      {
        if (SanityManager.DEBUG)
                {
View Full Code Here

    if ((insertFlag & Page.INSERT_UNDO_WITH_PURGE) != 0)
    {
      undoPage.purgeRecord(CLRInstant, slot, undoRecordId);

      RawTransaction rxact = (RawTransaction)xact;

      // If we purged the last row off an overflow page, reclaim that
      // page - we have to do this post transaction termination because we
      // are underneath the log right now and cannot interrupt the log
      // stream.
      if (rxact.handlesPostTerminationWork() &&
        undoPage.isOverflowPage() && undoPage.recordCount() == 0)
      {
        ReclaimSpace work =
          new ReclaimSpace(ReclaimSpace.PAGE, (PageKey)undoPage.getIdentity(),
                   rxact.getDataFactory(), true /* service ASAP */);
        rxact.addPostTerminationWork(work);
      }
    }
    else
    {
      undoPage.setDeleteStatus(CLRInstant, slot, true);
View Full Code Here

   */
  public final BasePage findpage(Transaction xact) throws StandardException
  {
    releaseResource(xact);

    RawTransaction rtran = (RawTransaction)xact;
    containerHdl = rtran.openDroppedContainer(pageId.getContainerId(),
      (LockingPolicy) null);

    if (containerHdl == null)
        {
      throw StandardException.newException(
                    SQLState.DATA_CONTAINER_VANISHED, pageId.getContainerId());
        }

    foundHere = true;

    // if container is dropped and committed, cannot look at any page,
        // it may be a container stub
    if (containerHdl.getContainerStatus() == RawContainerHandle.COMMITTED_DROP)
    {
      releaseResource(xact);
      return null;
    }

    StandardException getPageException = null;
    try
    {
      // get and latch page - we don't know the status of the page or what
      // kind of page we are looking for, get any type of page
      page = (BasePage)(containerHdl.getAnyPage(pageId.getPageNumber()));
    }
    catch (StandardException se)
    {
      getPageException = se;
    }
     
    //Try to initialize the page if page not found exception occurs during
    //recovery and the page version is zero(Init Page).
    //We do this if derby.storage.patchInitPageRecoverError is set.
    if (page == null && getPageException != null && pageVersion == 0)
      if (PropertyUtil.getSystemBoolean(RawStoreFactory.PATCH_INITPAGE_RECOVER_ERROR))
        page = getPageForRedoRecovery(xact);
   
    // maybe we are in rollforward recovery and this is an init page operation,
    // give subclass a chance to create the page
    if (page == null && getPageException != null)
    {
      //if are rolloforward recovery reload the page using load tran methods
      //that initialize the page. because in rollforward recovery, we
      //might be actually recreating the page container did not exist
      //in the backup when we started the rollforward recovery.

      if (rtran.inRollForwardRecovery())
      {
        if (SanityManager.DEBUG)
          if(SanityManager.DEBUG_ON("LoadTran"))
            SanityManager.DEBUG_PRINT(
                            "Trace", "got null page " + pageId +
View Full Code Here

  }

  protected void prepareForBulkLoad(BaseContainerHandle handle, int numPage)
  {
    clearPreallocThreshold();
    RawTransaction tran = handle.getTransaction();

    // find the last allocation page - do not invalidate the alloc cache,
    // we don't want to prevent other people from reading or writing
    // pages.
    AllocPage allocPage = findLastAllocPage(handle, tran);
View Full Code Here

        // TODO (mikem) - should a global scratch variable be used?

    // this is an overflow page purge, no need to lock the head row (it
    // has already been locked, hopefully).  No need to check for long rows
    // (they have already been deleted, hopefully).
    RawTransaction  t           = owner.getTransaction();
    int[]           recordId    = new int[1];

    recordId[0]                 = getHeaderAtSlot(slot).getId();

    owner.getActionSet().actionPurge(t, this, slot, 1, recordId, needDataLogged);
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.store.raw.xact.RawTransaction

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.