Examples of LogCounter


Examples of org.apache.derby.impl.store.raw.log.LogCounter

      {
        // The redo LWM is the current log instant.  We are going to
                // clean the cache shortly, any log record before this point
                // will not ever need to be redone.
        redoLWM_long = currentInstant();
        redoLWM = new LogCounter(redoLWM_long);

                // The undo LWM is what we need to rollback all transactions.
                // Synchronize this with the starting of a new transaction so
                // that the transaction factory can have a consistent view
                // See FileLogger.logAndDo

        LogCounter undoLWM = (LogCounter)(tf.firstUpdateInstant());
        if (undoLWM == null)
          undoLWM_long = redoLWM_long; // no active transaction
        else
          undoLWM_long = undoLWM.getValueAsLong();

      }

      /////////////////////////////////////////////////////
      // clean the buffer cache
      /////////////////////////////////////////////////////
      df.checkpoint();


      /////////////////////////////////////////////////////
      // write out the checkpoint log record
      /////////////////////////////////////////////////////
   
      // send the checkpoint record to the log
      Formatable transactionTable = tf.getTransactionTable();

      CheckpointOperation nextCheckpoint =
        new CheckpointOperation(
                    redoLWM_long, undoLWM_long, transactionTable);

      cptran.logAndDo(nextCheckpoint);

      LogCounter checkpointInstant =
                (LogCounter)(cptran.getLastLogInstant());

      if (checkpointInstant != null)
            {
                // since checkpoint is an internal transaction, I need to
                // flush it to make sure it actually goes to the log
        flush(checkpointInstant);
            }
      else
            {
        throw StandardException.newException(
                        SQLState.LOG_CANNOT_LOG_CHECKPOINT);
            }

      cptran.commit();

      if (needCPTran)
      {
        cptran.close()// if we started it, we will close it
        cptran = null;
      }

      /////////////////////////////////////////////////////
      // write out the log control file which contains the last
      // successful checkpoint log record
      /////////////////////////////////////////////////////

      if (!writeControlFile(getControlFileName(),
                  checkpointInstant.getValueAsLong()))
      {
        throw StandardException.newException(
                        SQLState.LOG_CONTROL_FILE, getControlFileName());
      }
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

      // don't flush, just use this to check if database is frozen or
      // corrupt
      fileNumber = 0;
      wherePosition = LogCounter.INVALID_LOG_INSTANT;
    } else {
      LogCounter whereC = (LogCounter) where;
      fileNumber = whereC.getLogFileNumber();
      wherePosition = whereC.getLogFilePosition();
    }
    flush(fileNumber, wherePosition);
  }
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

      startAt = firstLogInstant();
    }

    // ensure any buffered data is written to the actual file
    if (stopAt != null) {
      LogCounter stopCounter = (LogCounter) stopAt;
      flushBuffer(stopCounter.getLogFileNumber(),
            stopCounter.getLogFilePosition());
    } else {
      synchronized (this) {
        if (logOut != null)
          // flush to the end of the log
          logOut.flushLogAccessFile();
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

    public synchronized LogInstant getFirstUnflushedInstant()
  {
    if (SanityManager.DEBUG)
      SanityManager.ASSERT(logFileNumber > 0 && lastFlush > 0);

    return new LogCounter(logFileNumber,lastFlush);
  }
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

    {
      throw markCorrupt(
                    StandardException.newException(SQLState.LOG_IO_ERROR, ioe));
    }
    //remove the stub files
    df.removeDroppedContainerFileStubs(new LogCounter(redoLWM));
   
    if (inReplicationSlaveMode) {
      truncateLog(LogCounter.getLogFileNumber(undoLWM));
    }
  }
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

      {
        // The redo LWM is the current log instant.  We are going to
                // clean the cache shortly, any log record before this point
                // will not ever need to be redone.
        redoLWM_long = currentInstant();
        redoLWM = new LogCounter(redoLWM_long);

                // The undo LWM is what we need to rollback all transactions.
                // Synchronize this with the starting of a new transaction so
                // that the transaction factory can have a consistent view
                // See FileLogger.logAndDo

        LogCounter undoLWM = (LogCounter)(tf.firstUpdateInstant());
        if (undoLWM == null)
          undoLWM_long = redoLWM_long; // no active transaction
        else
          undoLWM_long = undoLWM.getValueAsLong();

      }

      /////////////////////////////////////////////////////
      // clean the buffer cache
      /////////////////////////////////////////////////////
      df.checkpoint();


      /////////////////////////////////////////////////////
      // write out the checkpoint log record
      /////////////////////////////////////////////////////
   
      // send the checkpoint record to the log
      Formatable transactionTable = tf.getTransactionTable();

      CheckpointOperation nextCheckpoint =
        new CheckpointOperation(
                    redoLWM_long, undoLWM_long, transactionTable);

      cptran.logAndDo(nextCheckpoint);

      LogCounter checkpointInstant =
                (LogCounter)(cptran.getLastLogInstant());

      if (checkpointInstant != null)
            {
                // since checkpoint is an internal transaction, I need to
                // flush it to make sure it actually goes to the log
        flush(checkpointInstant);
            }
      else
            {
        throw StandardException.newException(
                        SQLState.LOG_CANNOT_LOG_CHECKPOINT);
            }

      cptran.commit();

      if (needCPTran)
      {
        cptran.close()// if we started it, we will close it
        cptran = null;
      }

      /////////////////////////////////////////////////////
      // write out the log control file which contains the last
      // successful checkpoint log record
      /////////////////////////////////////////////////////

      if (!writeControlFile(getControlFileName(),
                  checkpointInstant.getValueAsLong()))
      {
        throw StandardException.newException(
                        SQLState.LOG_CONTROL_FILE, getControlFileName());
      }
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

      // don't flush, just use this to check if database is frozen or
      // corrupt
      fileNumber = 0;
      wherePosition = LogCounter.INVALID_LOG_INSTANT;
    } else {
      LogCounter whereC = (LogCounter) where;
      fileNumber = whereC.getLogFileNumber();
      wherePosition = whereC.getLogFilePosition();
    }
    flush(fileNumber, wherePosition);
  }
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

      startAt = firstLogInstant();
    }

    // ensure any buffered data is written to the actual file
    if (stopAt != null) {
      LogCounter stopCounter = (LogCounter) stopAt;
      flushBuffer(stopCounter.getLogFileNumber(),
            stopCounter.getLogFilePosition());
    } else {
      synchronized (this) {
        if (logOut != null)
          // flush to the end of the log
          logOut.flushLogAccessFile();
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

    public synchronized LogInstant getFirstUnflushedInstant()
  {
    if (SanityManager.DEBUG)
      SanityManager.ASSERT(logFileNumber > 0 && lastFlush > 0);

    return new LogCounter(logFileNumber,lastFlush);
  }
View Full Code Here

Examples of org.apache.derby.impl.store.raw.log.LogCounter

    {
      throw markCorrupt(
                    StandardException.newException(SQLState.LOG_IO_ERROR, ioe));
    }
    //remove the stub files
    df.removeDroppedContainerFileStubs(new LogCounter(redoLWM));
   
  }
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.