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

Examples of org.apache.derby.iapi.store.raw.log.LogInstant


    {
      synchronized(droppedTableStubInfo)
      {
        for (Enumeration e = droppedTableStubInfo.keys(); e.hasMoreElements(); )
        {
          LogInstant logInstant  = (LogInstant) e.nextElement();
          if(logInstant.lessThan(redoLWM))
          {
           
            Object[] removeInfo = (Object[]) droppedTableStubInfo.get(logInstant);
            Object identity = removeInfo[1];
            //delete the entry in the container cache.
View Full Code Here


    boolean renamed = false;
    boolean renameFailed = false;
    File oldbackup = null;
    File backupcopy = null;
    OutputStreamWriter historyFile = null;
    LogInstant backupInstant = logFactory.getFirstUnflushedInstant();

    try
    {
      // first figure out our name
      StorageFile dbase = storageFactory.newStorageFile( null); // The database directory
View Full Code Here

      synchronized(droppedTableStubInfo)
      {
        for (Enumeration e = droppedTableStubInfo.keys();
                     e.hasMoreElements(); )
        {
          LogInstant logInstant  = (LogInstant) e.nextElement();
          if(logInstant.lessThan(redoLWM))
          {
           
            Object[] removeInfo =
                            (Object[]) droppedTableStubInfo.get(logInstant);
            Object identity = removeInfo[1];
View Full Code Here

    File oldbackup = null;
    File backupcopy = null;
    OutputStreamWriter historyFile = null;
        StorageFile dbHistoryFile = null;
        File backupHistoryFile = null;
    LogInstant backupInstant = logFactory.getFirstUnflushedInstant();
       
    try
    {
      // get name of the current db, ie. database directory of current db.
      StorageFile dbase           = storageFactory.newStorageFile(null);
View Full Code Here

  public final void doMe(Transaction xact, LogInstant instant, LimitObjectInput in)
     throws StandardException, IOException
  {

    long oldversion = 0;    // sanity check
    LogInstant oldLogInstant = null; // sanity check
    if (SanityManager.DEBUG)
    {
      oldLogInstant = this.page.getLastLogInstant();
      oldversion = this.page.getPageVersion();

      SanityManager.ASSERT(oldversion == this.getPageVersion());
      SanityManager.ASSERT(oldLogInstant == null || instant == null
               || oldLogInstant.lessThan(instant));
    }

    // if this is called during runtime rollback, PageOp.generateUndo found
    // the page and have it latched there.
    // if this is called during recovery redo, this.needsRedo found the page and
View Full Code Here

  public final void doMe(Transaction xact, LogInstant instant, LimitObjectInput in)
     throws StandardException, IOException
  {

    long oldversion = 0;    // sanity check
    LogInstant oldLogInstant = null; // sanity check
    if (SanityManager.DEBUG)
    {
      oldLogInstant = this.page.getLastLogInstant();
      oldversion = this.page.getPageVersion();

      SanityManager.ASSERT(oldversion == this.getPageVersion());
      SanityManager.ASSERT(oldLogInstant == null || instant == null
               || oldLogInstant.lessThan(instant));
    }

    // if this is called during runtime rollback, PageOp.generateUndo found
    // the page and have it latched there.
    // if this is called during recovery redo, this.needsRedo found the page and
View Full Code Here

    Private methods.
    */
  private void setFirstUnflushed()
     throws StandardException, IOException
  {
    LogInstant firstUnflushedInstant =
      logFactory.getFirstUnflushedInstant();
    firstUnflushed = ((LogCounter)firstUnflushedInstant).getValueAsLong();
    firstUnflushedFileNumber = LogCounter.getLogFileNumber(firstUnflushed);
    firstUnflushedFilePosition = LogCounter.getLogFilePosition(firstUnflushed);

View Full Code Here

  public LogInstant getFirstLogInstant()
  {
    // assume for now that it is acceptable to return null if a transaction
    // starts right in the middle of this call.

        LogInstant logInstant = null;
        for (TransactionTableEntry entry : trans.values()) {
            if (entry.isUpdate()) {
                if (logInstant == null ||
                        entry.getFirstLog().lessThan(logInstant)) {
                    logInstant = entry.getFirstLog();
View Full Code Here

  public String getFirstLogInstantString()
  {
    if (SanityManager.DEBUG)
      SanityManager.ASSERT(isClone, "Should only call method on a clone");

    LogInstant logInstant =
            (myxact == null) ? null : myxact.getFirstLogInstant();

    return (logInstant == null) ? null : logInstant.toString();

  }   
View Full Code Here

      logicalOut.writeInt(optionalDataLength);
      completeLength = logOutputBuffer.getPosition() + optionalDataLength;


      LogInstant logInstant = null;
      int encryptedLength = 0; // in case of encryption, we need to pad

      try
      {
        if (logFactory.databaseEncrypted())
        {
          // we must pad the encryption data to be multiple of block
          // size, which is logFactory.getEncryptionBlockSize()
          encryptedLength = completeLength;
          if ((encryptedLength % logFactory.getEncryptionBlockSize()) != 0)
            encryptedLength = encryptedLength + logFactory.getEncryptionBlockSize() - (encryptedLength % logFactory.getEncryptionBlockSize());

          if (encryptionBuffer == null ||
            encryptionBuffer.length < encryptedLength)
            encryptionBuffer = new byte[encryptedLength];

          System.arraycopy(logOutputBuffer.getByteArray(), 0,
                   encryptionBuffer, 0, completeLength-optionalDataLength);

          if (optionalDataLength > 0)
            System.arraycopy(preparedLog, optionalDataOffset,
                   encryptionBuffer,
                   completeLength-optionalDataLength, optionalDataLength);

          // do not bother to clear out the padding area
          int len =
            logFactory.encrypt(encryptionBuffer, 0, encryptedLength,
                       encryptionBuffer, 0);

          if (SanityManager.DEBUG)
            SanityManager.ASSERT(len == encryptedLength,
              "encrypted log buffer length != log buffer len");
        }

        if ((operation.group() & (Loggable.FIRST | Loggable.LAST)) != 0)
        {
          synchronized (logFactory)
          {
            long instant = 0;

            if (logFactory.databaseEncrypted())
            {
              // encryption has completely drained both the the
              // logOuputBuffer array and the preparedLog array
              instant = logFactory.
                appendLogRecord(encryptionBuffer, 0,
                        encryptedLength, null,
                        -1, 0);
            }
            else
            {
              instant = logFactory.
                appendLogRecord(logOutputBuffer.getByteArray(),
                        0, completeLength, preparedLog,
                        optionalDataOffset,
                        optionalDataLength);
            }
            logInstant = new LogCounter(instant);

            operation.doMe(xact, logInstant, logIn);
          }
        }
        else
        {
          long instant = 0;

          if (logFactory.databaseEncrypted())
          {
            // encryption has completely drained both the the
            // logOuputBuffer array and the preparedLog array
            instant = logFactory.
              appendLogRecord(encryptionBuffer, 0,
                      encryptedLength, null, -1, 0);
          }
          else
          {
            instant = logFactory.
              appendLogRecord(logOutputBuffer.getByteArray(), 0,
                      completeLength, preparedLog,
                      optionalDataOffset,
                      optionalDataLength);
          }

          logInstant = new LogCounter(instant);

          operation.doMe(xact, logInstant, logIn);
        }

      }
      catch (StandardException se)
      {
        throw logFactory.markCorrupt(
                        StandardException.newException(
                            SQLState.LOG_DO_ME_FAIL, se, operation));
      }
      catch (IOException ioe)
      {
        throw logFactory.markCorrupt(
                        StandardException.newException(
                            SQLState.LOG_DO_ME_FAIL, ioe, operation));
      }
      finally
      {
        logIn.clearLimit();
      }

      if (SanityManager.DEBUG)
            {
                if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                {
                    SanityManager.DEBUG(
                        LogToFile.DBG_FLAG,
                        "Write log record: tranId=" + transactionId.toString() +
                        " instant: " + logInstant.toString() + " length: " +
                        completeLength + "\n" + operation + "\n");
                }
      }
      return logInstant;
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.store.raw.log.LogInstant

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.