Documentation of 'org.apache.derby.impl.store.raw.log.FileLogger' Java class
FileLogger
org.apache.derby.impl.store.raw.log

Class FileLogger

  • All Implemented Interfaces:
    Logger


    public class FileLogger
    extends java.lang.Object
    implements Logger
    Write log records to a log file as a stream (ie. log records added to the end of the file, no concept of pages).

    The format of a log record that is not a compensation operation is

    See Also:
    LogRecord
    • Constructor Detail

      • FileLogger

        public FileLogger(LogToFile logFactory)
        Make a new Logger with its own log record buffers MT - not needed for constructor
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Close the logger. MT - caller provide synchronization (RESOLVE: not called by anyone ??)
        Throws:
        java.io.IOException
      • logAndDo

        public LogInstant logAndDo(RawTransaction xact,
                                   Loggable operation)
                            throws StandardException
        Writes out a log record to the log stream, and call its doMe method to apply the change to the rawStore.
        Any optional data the doMe method need is first written to the log stream using operation.writeOptionalData, then whatever is written to the log stream is passed back to the operation for the doMe method.

        MT - there could be multiple threads running in the same raw transactions and they can be calling the same logger to log different log operations. This whole method is synchronized to make sure log records are logged one at a time.

        Specified by:
        logAndDo in interface Logger
        Parameters:
        xact - the transaction logging the change
        operation - the log operation
        Returns:
        the instant in the log that can be used to identify the log record
        Throws:
        StandardException - Derby Standard error policy
      • logAndUndo

        public LogInstant logAndUndo(RawTransaction xact,
                                     Compensation compensation,
                                     LogInstant undoInstant,
                                     LimitObjectInput in)
                              throws StandardException
        Writes out a compensation log record to the log stream, and call its doMe method to undo the change of a previous log operation.

        MT - Not needed. A transaction must be single threaded thru undo, each RawTransaction has its own logger, therefore no need to synchronize. The RawTransaction must handle synchronizing with multiple threads during rollback.

        Specified by:
        logAndUndo in interface Logger
        Parameters:
        xact - the transaction logging the change
        compensation - the compensation log operation
        undoInstant - the log instant of the operation that is to be rolled back
        in - optional data input for the compenastion doMe method
        Returns:
        the instant in the log that can be used to identify the log record
        Throws:
        StandardException - Derby Standard error policy
      • flush

        public void flush(LogInstant where)
                   throws StandardException
        Flush the log up to the given log instant.

        MT - not needed, wrapper method

        Specified by:
        flush in interface Logger
        Parameters:
        where - flush log up to here
        Throws:
        StandardException - cannot sync log file
      • reprepare

        public void reprepare(RawTransaction t,
                              TransactionId prepareId,
                              LogInstant prepareStopAt,
                              LogInstant prepareStartAt)
                       throws StandardException
        During recovery re-prepare a transaction.

        After redo() and undo(), this routine is called on all outstanding in-doubt (prepared) transactions. This routine re-acquires all logical write locks for operations in the xact, and then modifies the transaction table entry to make the transaction look as if it had just been prepared following startup after recovery.

        Specified by:
        reprepare in interface Logger
        Parameters:
        t - is the transaction performing the re-prepare
        prepareId - is the transaction ID to be re-prepared
        prepareStopAt - is where the log instant (inclusive) where the re-prepare should stop.
        prepareStartAt - is the log instant (inclusive) where re-prepare should begin, this is normally the log instant of the last log record of the transaction that is to be re-prepare. If null, then re-prepare starts from the end of the log.
        Throws:
        StandardException - Standard exception policy.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.