Examples of RawContainerHandle


Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

        throw T_Fail.testFailMsg("expect internal transaction to rollback");

      LockingPolicy nolock =
                tuser.newLockingPolicy(LockingPolicy.MODE_NONE, 0, false);

      RawContainerHandle stub =
        ((RawTransaction)tuser).openDroppedContainer(
          id3, nolock);

      if (stub == null)
        throw T_Fail.testFailMsg("expect container to be dropped");

      if (stub.getContainerStatus() != RawContainerHandle.COMMITTED_DROP)
        throw T_Fail.testFailMsg("expect container to be committed dropped");

      // this should fail
      p3 = stub.getPage(r3.getPageNumber());

      if (p3 != null)
        throw T_Fail.testFailMsg("should not getpage with committed dropped container");

      PASS("P054");
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

        throw T_Fail.testFailMsg("expect container to be dropped");

      LockingPolicy nolock =
        t.newLockingPolicy(LockingPolicy.MODE_NONE, 0, false);

      RawContainerHandle stub =
        ((RawTransaction)t).openDroppedContainer(
          new ContainerKey(0, cid1), nolock);
     
      /*Not true always after fix for p4#25641(fix for bug:4580)
        Checkpoint calls cleans up the stubs that not necessary
        for recovery.
        if (stub == null)
        throw T_Fail.testFailMsg("drop container should still be there");
      */
      if(stub!=null)
        if (stub.getContainerStatus() != RawContainerHandle.COMMITTED_DROP)
          throw T_Fail.testFailMsg("expect container to be committed dropped");

      long cid2 = t_util.t_addContainer(t, 0);
      ContainerHandle c2 = t_util.t_openContainer(t, 0, cid2, true);
      page = t_util.t_addPage(c2);
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

      ContainerKey id1 = new ContainerKey(0, cid1);
      ContainerHandle c = t.openContainer(id1, ContainerHandle.MODE_READONLY);
      if (c != null)
        throw T_Fail.testFailMsg("expect container to be dropped");

      RawContainerHandle stub = ((RawTransaction)t).openDroppedContainer(
        id1, nolock);
      /*Not true always after fix for p4#25641(fix for bug:4580)
        Checkpoint calls cleans up the stubs that not necessary
        for recovery.
        if (stub == null)
        throw T_Fail.testFailMsg("drop container should still be there");
      */
      if(stub!=null)
        if (stub.getContainerStatus() != RawContainerHandle.COMMITTED_DROP)
          throw T_Fail.testFailMsg("expect container to be committed dropped");

      ContainerKey id2 = new ContainerKey(0, cid2);
      c = t.openContainer(id2, ContainerHandle.MODE_READONLY);
      if (c != null)
        throw T_Fail.testFailMsg("expect container to be dropped");

      stub = ((RawTransaction)t).openDroppedContainer(
        id2, nolock);
      /*Not true always after fix for p4#25641(fix for bug:4580)
        Checkpoint calls cleans up the stubs that not necessary
        for recovery.
        if (stub == null)
        throw T_Fail.testFailMsg("drop container should still be there");
      */
      if(stub!=null)
        if (stub.getContainerStatus() != RawContainerHandle.COMMITTED_DROP)
          throw T_Fail.testFailMsg("expect container to be committed dropped");

    }
    finally
    {
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

    if (SanityManager.DEBUG)
      SanityManager.ASSERT(container_xlock != null);

    // Try to just get the container thru the transaction.
    // Need to do this to transition the transaction to active state.
    RawContainerHandle containerHdl = tran.openDroppedContainer(
                work.getContainerId(),
                container_xlock);

    // if it can get lock but it is not deleted or has already been
    // deleted, done work
    if (containerHdl == null ||
      containerHdl.getContainerStatus() == RawContainerHandle.NORMAL ||
      containerHdl.getContainerStatus() == RawContainerHandle.COMMITTED_DROP)
    {
      if (containerHdl != null)
        containerHdl.close();
      tran.abort()// release xlock, if any

      if (SanityManager.DEBUG)
            {
                if (SanityManager.DEBUG_ON(DaemonService.DaemonTrace))
                {
                    SanityManager.DEBUG(
                        DaemonService.DaemonTrace, "  aborted " + work);
                }
            }
    } 
    else
    {
      // we got an xlock on a dropped container.  Must be committed.
      // Get rid of the container now.
      ContainerOperation lop = new
        ContainerOperation(containerHdl, ContainerOperation.REMOVE);

      // 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.
      containerHdl.preDirty(true);
      try
      {
        tran.logAndDo(lop);
      }
      finally
      {
        // in case logAndDo fail, make sure the container is not
        // stuck in preDirty state.
        containerHdl.preDirty(false);
      }


      containerHdl.close();
      tran.commit();

      if (SanityManager.DEBUG)
            {
                if (SanityManager.DEBUG_ON(DaemonService.DaemonTrace))
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

    setActiveState();

    if (locking == null)
      locking = xactFactory.getLockingPolicy(LockingPolicy.MODE_NONE, TransactionController.ISOLATION_NOLOCK, false);

    RawContainerHandle hdl = null;

    // first try to open it for update, if that fail, open it for read
    try
    {
      hdl = dataFactory.openDroppedContainer(this, containerId, locking,
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

                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();
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

    }

    // close all open containers and 'onCommit' objects of this container
    t.notifyObservers(ckey);

    RawContainerHandle containerHdl = (RawContainerHandle)
      t.openContainer(ckey, cl, ContainerHandle.MODE_FORUPDATE);

    // If container is already dropped or is no longer there, throw
    // containerVanished exception unless container is temporary, in that
    // case just return.  Upper layer is supposed to prevent such from
    // happening thru some means other than the lock we are getting here.
    try
    {
      if (containerHdl == null ||
        containerHdl.getContainerStatus() != RawContainerHandle.NORMAL)
      {
        // If we are a temp container, don't worry about it.
        if (tmpContainer)
        {
          if (containerHdl != null)
            containerHdl.removeContainer((LogInstant)null);
          return;
        }
        else
                {
          throw StandardException.newException(
                            SQLState.DATA_CONTAINER_VANISHED, ckey);
                }
      }

      // Container exist, is updatable and we got the lock.
      if (tmpContainer)
      {
        containerHdl.dropContainer((LogInstant)null, true);
        containerHdl.removeContainer((LogInstant)null);
      }
      else
      {
        ContainerOperation lop =
          new ContainerOperation(
                            containerHdl, ContainerOperation.DROP);

        // 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.
        containerHdl.preDirty(true);
        try
        {
          t.logAndDo(lop);
        }
        finally
        {
          // in case logAndDo fail, make sure the container is not
          // stuck in preDirty state.
          containerHdl.preDirty(false);
        }


        // remember this as a post commit work item
        Serviceable p =
                    new ReclaimSpace(
                            ReclaimSpace.CONTAINER,
                            ckey,
                            this,
                            true /* service ASAP */);

        if (SanityManager.DEBUG)
                {
                    if (SanityManager.DEBUG_ON(DaemonService.DaemonTrace))
                    {
                        SanityManager.DEBUG(
                            DaemonService.DaemonTrace,
                            "Add post commit work " + p);
                    }
                }

        t.addPostCommitWork(p);
      }

    }
    finally
    {
      if (containerHdl != null)
        containerHdl.close();
    }


  }
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

                               true);

        if (SanityManager.DEBUG )
            SanityManager.ASSERT(cl != null);

        RawContainerHandle containerHdl = (RawContainerHandle)
            t.openContainer(ckey, cl, ContainerHandle.MODE_FORUPDATE);

        if (SanityManager.DEBUG )
            SanityManager.ASSERT(containerHdl != null);

        EncryptContainerOperation lop =
            new EncryptContainerOperation(containerHdl);
        t.logAndDo(lop);

        // flush the log to reduce the window between where
        // the encrypted container is created & synced and the
        // log record for it makes it to disk. if we fail during
        // encryption of the container, log record will make sure
        // container is restored to the original state and
        // any temporary files are cleaned up.
        dataFactory.flush(t.getLastLogInstant());

        // encrypt the container.
        String newFilePath = getFilePath(ckey, false);
        StorageFile newFile = storageFactory.newStorageFile(newFilePath);
        containerHdl.encryptOrDecryptContainer(newFilePath, doEncrypt);
        containerHdl.close();


        /*
         * Replace the current container file with the new container file after
         * keeping a copy of the current container file, it will be removed on
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

        throw T_Fail.testFailMsg("expect internal transaction to rollback");

      LockingPolicy nolock =
                tuser.newLockingPolicy(LockingPolicy.MODE_NONE, 0, false);

      RawContainerHandle stub =
        ((RawTransaction)tuser).openDroppedContainer(
          id3, nolock);

      if (stub == null)
        throw T_Fail.testFailMsg("expect container to be dropped");

      if (stub.getContainerStatus() != RawContainerHandle.COMMITTED_DROP)
        throw T_Fail.testFailMsg("expect container to be committed dropped");

      // this should fail
      p3 = stub.getPage(r3.getPageNumber());

      if (p3 != null)
        throw T_Fail.testFailMsg("should not getpage with committed dropped container");

      PASS("P054");
View Full Code Here

Examples of org.apache.derby.iapi.store.raw.data.RawContainerHandle

                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();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.