All Known Implementing Classes:
CASDiskWriteAheadLog, OMemoryWriteAheadLog

public interface OWriteAheadLog
Since:
6/25/14
Author:
Andrey Lomakin (a.lomakin-at-orientdb.com)
  • Field Details

  • Method Details

    • begin

    • begin

      OLogSequenceNumber begin(long segmentId) throws IOException
      Throws:
      IOException
    • end

    • flush

      void flush()
    • logAtomicOperationStartRecord

      OLogSequenceNumber logAtomicOperationStartRecord(boolean isRollbackSupported, long unitId, byte[] metadata)
    • logAtomicOperationStartRecord

      OLogSequenceNumber logAtomicOperationStartRecord(boolean isRollbackSupported, long unitId) throws IOException
      Throws:
      IOException
    • logAtomicOperationEndRecord

      OLogSequenceNumber logAtomicOperationEndRecord(long operationUnitId, boolean rollback, OLogSequenceNumber startLsn, Map<String,OAtomicOperationMetadata<?>> atomicOperationMetadata) throws IOException
      Throws:
      IOException
    • log

      Throws:
      IOException
    • close

      void close() throws IOException
      Throws:
      IOException
    • close

      void close(boolean flush) throws IOException
      Throws:
      IOException
    • delete

      void delete() throws IOException
      Throws:
      IOException
    • read

      List<WriteableWALRecord> read(OLogSequenceNumber lsn, int limit) throws IOException
      Throws:
      IOException
    • next

      List<WriteableWALRecord> next(OLogSequenceNumber lsn, int limit) throws IOException
      Throws:
      IOException
    • getFlushedLsn

      OLogSequenceNumber getFlushedLsn()
    • cutTill

      boolean cutTill(OLogSequenceNumber lsn) throws IOException
      Cut WAL content till passed in value of LSN at maximum in many cases smaller portion of WAL may be cut. If value of LSN is bigger than values provided in addCutTillLimit(OLogSequenceNumber) then "protected" part of WAL will be preserved for sure.
      Parameters:
      lsn - Maximum value of LSN till WAL will be cut.
      Returns:
      true if some portion of WAL will be cut and false if WAL left untouched.
      Throws:
      IOException
    • cutAllSegmentsSmallerThan

      boolean cutAllSegmentsSmallerThan(long segmentId) throws IOException
      Throws:
      IOException
    • addCheckpointListener

      void addCheckpointListener(OCheckpointRequestListener listener)
    • removeCheckpointListener

      void removeCheckpointListener(OCheckpointRequestListener listener)
    • moveLsnAfter

      void moveLsnAfter(OLogSequenceNumber lsn) throws IOException
      Next LSN generated by WAL will be bigger than passed in value. DO NOT REMOVE IT, USED IN ENTERPRISE STORAGE.
      Throws:
      IOException
    • addCutTillLimit

      void addCutTillLimit(OLogSequenceNumber lsn)
      Adds LSN after which WAL log should be preserved. It is possible to add many such LSNs smallest value among them will be used to limit value of LSN after which WAL may be cut.
      Parameters:
      lsn - LSN after which cut of the WAL is not allowed.
      See Also:
    • removeCutTillLimit

      void removeCutTillLimit(OLogSequenceNumber lsn)
      Removes LSN after which WAL log should be preserved. It is possible to add many such LSNs smallest value among them will be used to limit value of LSN after which WAL may be cut.
      Parameters:
      lsn - LSN after which cut of the WAL is not allowed.
      See Also:
    • nonActiveSegments

      File[] nonActiveSegments(long fromSegment)
    • nonActiveSegments

      long[] nonActiveSegments()
    • activeSegment

      long activeSegment()
    • addEventAt

      void addEventAt(OLogSequenceNumber lsn, Runnable event)
      Adds the event to fire when this write ahead log instances reaches the given LSN. The thread on which the event will be fired is unspecified, the event may be even fired synchronously before this method returns. Avoid running long tasks in the event handler since this may degrade the performance of this write ahead log and/or its event managing component. The exact LSN, up to which this write ahead log is actually grown, may differ from the event's LSN at the moment of invocation. But it's guarantied that the write ahead log's LSN will be larger than or equal to the event's LSN. In other words, the event invocation may be postponed, exact timings depend on implementation details of this write ahead log.
      Parameters:
      lsn - the LSN to fire at.
      event - the event to fire.
    • appendNewSegment

      boolean appendNewSegment()
      Adds new segment so all subsequent log entries will be added to this new segment. New segment can not be appended if:
      1. WAL is empty
      2. There last segment in WAL is empty.
      Despite of the fact that WAL segment will not be appended, method call still will reach its main target, all subsequent log records will have segment number higher than previously logged records. But to inform user that segment is not added result of success of failure of this method will be returned.
      Returns:
      true if new segment is added, and false otherwise.