Interface OWriteAheadLog
- All Known Implementing Classes:
CASDiskWriteAheadLog,OMemoryWriteAheadLog
public interface OWriteAheadLog
- Since:
- 6/25/14
- Author:
- Andrey Lomakin (a.lomakin-at-orientdb.com)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongvoidvoidAdds LSN after which WAL log should be preserved.voidaddEventAt(OLogSequenceNumber lsn, Runnable event) Adds the event to fire when this write ahead log instances reaches the given LSN.booleanAdds new segment so all subsequent log entries will be added to this new segment.begin()begin(long segmentId) voidclose()voidclose(boolean flush) booleancutAllSegmentsSmallerThan(long segmentId) booleanCut WAL content till passed in value of LSN at maximum in many cases smaller portion of WAL may be cut.voiddelete()end()voidflush()log(WriteableWALRecord record) logAtomicOperationEndRecord(long operationUnitId, boolean rollback, OLogSequenceNumber startLsn, Map<String, OAtomicOperationMetadata<?>> atomicOperationMetadata) logAtomicOperationStartRecord(boolean isRollbackSupported, long unitId) logAtomicOperationStartRecord(boolean isRollbackSupported, long unitId, byte[] metadata) voidNext LSN generated by WAL will be bigger than passed in value.next(OLogSequenceNumber lsn, int limit) long[]File[]nonActiveSegments(long fromSegment) read(OLogSequenceNumber lsn, int limit) voidvoidRemoves LSN after which WAL log should be preserved.
-
Field Details
-
MASTER_RECORD_EXTENSION
- See Also:
-
WAL_SEGMENT_EXTENSION
- See Also:
-
-
Method Details
-
begin
OLogSequenceNumber begin() -
begin
- Throws:
IOException
-
end
OLogSequenceNumber 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
- Throws:
IOException
-
close
- Throws:
IOException
-
delete
- Throws:
IOException
-
read
- Throws:
IOException
-
next
- Throws:
IOException
-
getFlushedLsn
OLogSequenceNumber getFlushedLsn() -
cutTill
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 inaddCutTillLimit(OLogSequenceNumber)then "protected" part of WAL will be preserved for sure.- Parameters:
lsn- Maximum value of LSN till WAL will be cut.- Returns:
trueif some portion of WAL will be cut andfalseif WAL left untouched.- Throws:
IOException
-
cutAllSegmentsSmallerThan
- Throws:
IOException
-
addCheckpointListener
-
removeCheckpointListener
-
moveLsnAfter
Next LSN generated by WAL will be bigger than passed in value. DO NOT REMOVE IT, USED IN ENTERPRISE STORAGE.- Throws:
IOException
-
addCutTillLimit
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
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
-
nonActiveSegments
long[] nonActiveSegments() -
activeSegment
long activeSegment() -
addEventAt
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:- WAL is empty
- There last segment in WAL is empty.
- Returns:
trueif new segment is added, andfalseotherwise.
-