Interface IRedoLogFile<T extends IReplicationOrderedPacket>
- All Superinterfaces:
IRedoLogFileStatistics
- All Known Implementing Classes:
DBMemoryRedoLogFile, DBSwapRedoLogFile, FixedSizeSwapRedoLogFile, MemoryRedoLogFile
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 Summary
Modifier and TypeMethodDescriptionvoidAdd a replication packet to the file as the latest packetvoidclose()Closes the redo log filevoiddeleteOldestPackets(long packetsCount) Deletes the oldest packets, starting from the oldest up until the specified batch sizedefault intFlush redo-log packets from memory to underlying storage.longGets 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.longdefault RedoLogSwapStorageTypelongbooleanisEmpty()performCompaction(long from, long to) readOnlyIterator(long fromKey) Remove and returns the oldest replication packet in the filelongsize()voidValidates the integrity of the redo log fileMethods inherited from interface IRedoLogFileStatistics
getExternalStoragePacketsCount, getExternalStoragePacketsWeight, getExternalStorageSpaceUsed, getMemoryPacketsCount, getMemoryPacketsWeight
-
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
Add a replication packet to the file as the latest packet- Parameters:
replicationPacket- packet to add
-
size
long size()- Specified by:
sizein interfaceIRedoLogFileStatistics- 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
- 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
Validates the integrity of the redo log file- Throws:
RedoLogFileCompromisedException
-
close
void close()Closes the redo log file -
getWeight
long getWeight() -
performCompaction
- Parameters:
from- key to start searching transient packet fromto- 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
-