Interface IRedoLogFile<T extends IReplicationOrderedPacket>

All Superinterfaces:
IRedoLogFileStatistics
All Known Implementing Classes:
DBMemoryRedoLogFile, DBSwapRedoLogFile, FixedSizeSwapRedoLogFile, MemoryRedoLogFile

public interface IRedoLogFile<T extends IReplicationOrderedPacket> extends IRedoLogFileStatistics
Acts as the redo log packets storage MemoryRedoLogFile Implementor should support concurrent readers or a single writer, in other words, the implementor can assume access to this structure are guarded with a reader writer lock according to the operation type An exception is getApproximateSize() method which should not assume a reader lock is held.
Since:
7.1
Author:
eitany
  • Method Details

    • removeOldest

      T removeOldest()
      Remove and returns the oldest replication packet in the file
      Returns:
      returns the oldest replication packet in the file
    • getOldest

      T getOldest()
      Returns:
      Gets the oldest replication packet in the file
    • getOldestKey

      long getOldestKey()
    • add

      void add(T replicationPacket)
      Add a replication packet to the file as the latest packet
      Parameters:
      replicationPacket - packet to add
    • size

      long size()
      Specified by:
      size in interface IRedoLogFileStatistics
      Returns:
      the number of replication packets held in the file
    • getApproximateSize

      long getApproximateSize()
      Gets an approximation of the number of replication packets held in the file, implementation of this method should not assume a reader lock is held and hence can return a result which is not accurate if it cannot do so without a lock.
      Returns:
      an approximation of the replication packets held in the file
    • isEmpty

      boolean isEmpty()
      Returns:
      true if the file has no replication packets stored
    • readOnlyIterator

      ReadOnlyIterator<T> readOnlyIterator(long fromKey)
      Parameters:
      fromKey - index to start from
      Returns:
      read only iterator over the packets in the file that will start from the given index, where 0 specified the oldest packet
    • deleteOldestPackets

      void deleteOldestPackets(long packetsCount)
      Deletes the oldest packets, starting from the oldest up until the specified batch size
      Parameters:
      packetsCount - number of oldest packets to delete
    • validateIntegrity

      void validateIntegrity() throws RedoLogFileCompromisedException
      Validates the integrity of the redo log file
      Throws:
      RedoLogFileCompromisedException
    • close

      void close()
      Closes the redo log file
    • getWeight

      long getWeight()
    • performCompaction

      CompactionResult performCompaction(long from, long to)
      Parameters:
      from - key to start searching transient packet from
      to - key to end searching transient packet from
      Returns:
      number of discarded packets
    • flushToStorage

      default int flushToStorage()
      Flush redo-log packets from memory to underlying storage. Not thread safe, should be called under lock and only when the space is in quiesce mode.
      Returns:
      number of flushed packets
      Since:
      16.2
    • getSwapStorageType

      default RedoLogSwapStorageType getSwapStorageType()