Examples of RawContainerHandle


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

    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

  {
    if (operation == REMOVE)
      return null;    // cannot undo REMOVE
    else
    {
      RawContainerHandle undoContainerHandle = findContainer(tran);
     
      // 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.
      //
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.encryptContainer(newFilePath);
        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
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.