Examples of LogCounter


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

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

    {
      close();

      throw StandardException.newException(
                    SQLState.LOG_RESET_BEYOND_SCAN_LIMIT,
                    instant, new LogCounter(stopAt));
    }
    else
    {
      long fnum = ((LogCounter)instant).getLogFileNumber();
View Full Code Here

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

  public LogInstant getLogInstant()
  {
    if (currentInstant == LogCounter.INVALID_LOG_INSTANT)
      return null;
    else
      return new LogCounter(currentInstant);
  }
View Full Code Here

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

                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);
        }

      }
View Full Code Here

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

        instant = logFactory.
          appendLogRecord(logOutputBuffer.getByteArray(),
                  0, completeLength, null, 0, 0);
      }

      LogInstant logInstant = new LogCounter(instant);

      if (SanityManager.DEBUG)
            {
                if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                {
                    SanityManager.DEBUG(
                        LogToFile.DBG_FLAG,
                        "Write CLR: Xact: " + transactionId.toString() +
                        "clrinstant: " + logInstant.toString() +
                        " undoinstant " + undoInstant + "\n");
                }
      }

      try
View Full Code Here

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

                                    "Skipping over CLRs, reset scan to " +
                                    LogCounter.toDebugString(prepareInstant));
                        }
          }

          scanLog.resetPosition(new LogCounter(prepareInstant));
          // scanLog now positioned at the beginning of the log
          // record that was rolled back by this CLR.
          // The scan is a backward one so getNextRecord will skip
          // over the record that was rolled back and go to the one
          // previous to it
View Full Code Here

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

                                LogCounter.toDebugString(undoInstant));
                        }
                    }


          scanLog.resetPosition(new LogCounter(undoInstant));

          // scanLog now positioned at the beginning of the log
          // record that was rolled back by this CLR.
          // The scan is a backward one so getNextRecord will skip
          // over the record that was rolled back and go to the one
          // previous to it

          continue;
        }

        lop = record.getUndoable();

        if (lop != null)
        {
          int optionalDataLength = rawInput.readInt();
          int savePosition = rawInput.getPosition();
          rawInput.setLimit(optionalDataLength);
 
          compensation = lop.generateUndo(t, rawInput);

          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
                            SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "Rollback log record at instant " +
                                LogCounter.toDebugString(scanLog.getInstant()) +
                                " : " + lop);
                        }
                    }

          clrgenerated++;

          if (compensation != null)
          {
            // generateUndo may have read stuff off the
            // stream, reset it for the undo operation.
            rawInput.setLimit(savePosition, optionalDataLength);

            // log the compensation op that rolls back the
                        // operation at this instant
            t.logAndUndo(
                            compensation, new LogCounter(scanLog.getInstant()),
                            rawInput);

            compensation.releaseResource(t);
            compensation = null;
          }
View Full Code Here

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

                logFactory.openForwardsScan(
                                    undoInstant,(LogInstant)null);
            }
            else
            {
              undoScan.resetPosition(new LogCounter(undoInstant));
            }

            // undoScan now positioned at the beginning of the log
            // record was rolled back by this CLR. 
            // The scan is a forward one so getNextRecord will get
                        // the log record that needs to be rolled back.

            // reuse the buffer in logIn and logIn since CLR
                        // has no optional data and has no use for them anymore
            logIn.clearLimit();
            LogRecord undoRecord =
              undoScan.getNextRecord(logIn, null, 0);

            Undoable undoOp = undoRecord.getUndoable();

            if (SanityManager.DEBUG)
            {
              SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "Redoing CLR: undoInstant = " +
                                    LogCounter.toDebugString(undoInstant) +
                                " clrinstant = " +
                                    LogCounter.toDebugString(instant));

              SanityManager.ASSERT(
                                undoRecord.getTransactionId().equals(tranId));

              SanityManager.ASSERT(undoOp != null);
            }

            ((Compensation)op).setUndoOp(undoOp);
          }

          // at this point, logIn points to the optional
          // data of the loggable that is to be redone or to be
          // rolled back
         
          if (SanityManager.DEBUG)
                    {
                        if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                        {
                            SanityManager.DEBUG(
                                LogToFile.DBG_FLAG,
                                "redoing " + op +
                                " instant = " +
                                LogCounter.toDebugString(instant));
                        }
                    }

          int dataLength = logIn.readInt();
          logIn.setLimit(dataLength);
                   
          // even though the log has already been written, we need to
          // tie the page to the log stream so that if redo failed
          // for some reasons, the log factory's corruption will stop
          // the corrupt page from flushing to disk.

          op.doMe(
                        recoveryTransaction,
                        new LogCounter(instant), logIn);

          op.releaseResource(recoveryTransaction);

          op = null;
        }
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.