Class CASDiskWriteAheadLog
java.lang.Object
com.orientechnologies.orient.core.storage.impl.local.paginated.wal.cas.CASDiskWriteAheadLog
- All Implemented Interfaces:
OWriteAheadLog
-
Field Summary
FieldsFields inherited from interface com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OWriteAheadLog
MASTER_RECORD_EXTENSION, WAL_SEGMENT_EXTENSION -
Constructor Summary
ConstructorsConstructorDescriptionCASDiskWriteAheadLog(String storageName, Path storagePath, Path walPath, int maxPagesCacheSize, int bufferSize, byte[] aesKey, byte[] iv, long segmentsInterval, long maxSegmentSize, int commitDelay, boolean filterWALFiles, Locale locale, long walSizeHardLimit, int fsyncInterval, boolean keepSingleWALSegment, boolean callFsync, boolean printPerformanceStatistic, int statisticPrintInterval) -
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.voidappendSegment(long segmentIndex) 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()voidexecuteWriteRecords(boolean forceSync, boolean fullWrite) voidflush()log(WriteableWALRecord writeableRecord) logAtomicOperationEndRecord(long operationUnitId, boolean rollback, OLogSequenceNumber startLsn, Map<String, OAtomicOperationMetadata<?>> atomicOperationMetadata) logAtomicOperationStartRecord(boolean isRollbackSupported, long unitId) logAtomicOperationStartRecord(boolean isRollbackSupported, long unitId, byte[] metadata) protected intvoidNext LSN generated by WAL will be bigger than passed in value.next(OLogSequenceNumber lsn, int limit) long[]File[]nonActiveSegments(long fromSegment) intpageSize()read(OLogSequenceNumber lsn, int limit) voidvoidRemoves LSN after which WAL log should be preserved.
-
Field Details
-
DEFAULT_MAX_CACHE_SIZE
protected static final int DEFAULT_MAX_CACHE_SIZE- See Also:
-
-
Constructor Details
-
CASDiskWriteAheadLog
public CASDiskWriteAheadLog(String storageName, Path storagePath, Path walPath, int maxPagesCacheSize, int bufferSize, byte[] aesKey, byte[] iv, long segmentsInterval, long maxSegmentSize, int commitDelay, boolean filterWALFiles, Locale locale, long walSizeHardLimit, int fsyncInterval, boolean keepSingleWALSegment, boolean callFsync, boolean printPerformanceStatistic, int statisticPrintInterval) throws IOException - Throws:
IOException
-
-
Method Details
-
pageSize
public int pageSize() -
maxCacheSize
protected int maxCacheSize() -
read
- Specified by:
readin interfaceOWriteAheadLog- Throws:
IOException
-
next
- Specified by:
nextin interfaceOWriteAheadLog- Throws:
IOException
-
addEventAt
Description copied from interface:OWriteAheadLogAdds 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.- Specified by:
addEventAtin interfaceOWriteAheadLog- Parameters:
lsn- the LSN to fire at.event- the event to fire.
-
delete
- Specified by:
deletein interfaceOWriteAheadLog- Throws:
IOException
-
addCutTillLimit
Description copied from interface:OWriteAheadLogAdds 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.- Specified by:
addCutTillLimitin interfaceOWriteAheadLog- Parameters:
lsn- LSN after which cut of the WAL is not allowed.- See Also:
-
removeCutTillLimit
Description copied from interface:OWriteAheadLogRemoves 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.- Specified by:
removeCutTillLimitin interfaceOWriteAheadLog- Parameters:
lsn- LSN after which cut of the WAL is not allowed.- See Also:
-
logAtomicOperationStartRecord
- Specified by:
logAtomicOperationStartRecordin interfaceOWriteAheadLog
-
logAtomicOperationStartRecord
public OLogSequenceNumber logAtomicOperationStartRecord(boolean isRollbackSupported, long unitId, byte[] metadata) - Specified by:
logAtomicOperationStartRecordin interfaceOWriteAheadLog
-
logAtomicOperationEndRecord
public OLogSequenceNumber logAtomicOperationEndRecord(long operationUnitId, boolean rollback, OLogSequenceNumber startLsn, Map<String, OAtomicOperationMetadata<?>> atomicOperationMetadata) - Specified by:
logAtomicOperationEndRecordin interfaceOWriteAheadLog
-
log
- Specified by:
login interfaceOWriteAheadLog
-
begin
- Specified by:
beginin interfaceOWriteAheadLog
-
begin
- Specified by:
beginin interfaceOWriteAheadLog
-
cutAllSegmentsSmallerThan
- Specified by:
cutAllSegmentsSmallerThanin interfaceOWriteAheadLog- Throws:
IOException
-
cutTill
Description copied from interface:OWriteAheadLogCut 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 inOWriteAheadLog.addCutTillLimit(OLogSequenceNumber)then "protected" part of WAL will be preserved for sure.- Specified by:
cutTillin interfaceOWriteAheadLog- 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
-
activeSegment
public long activeSegment()- Specified by:
activeSegmentin interfaceOWriteAheadLog
-
appendNewSegment
public boolean appendNewSegment()Description copied from interface:OWriteAheadLogAdds 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.
- Specified by:
appendNewSegmentin interfaceOWriteAheadLog- Returns:
trueif new segment is added, andfalseotherwise.
-
appendSegment
public void appendSegment(long segmentIndex) -
getWalFiles
-
moveLsnAfter
Description copied from interface:OWriteAheadLogNext LSN generated by WAL will be bigger than passed in value. DO NOT REMOVE IT, USED IN ENTERPRISE STORAGE.- Specified by:
moveLsnAfterin interfaceOWriteAheadLog
-
nonActiveSegments
public long[] nonActiveSegments()- Specified by:
nonActiveSegmentsin interfaceOWriteAheadLog
-
nonActiveSegments
- Specified by:
nonActiveSegmentsin interfaceOWriteAheadLog
-
flush
public void flush()- Specified by:
flushin interfaceOWriteAheadLog
-
close
- Specified by:
closein interfaceOWriteAheadLog- Throws:
IOException
-
close
- Specified by:
closein interfaceOWriteAheadLog- Throws:
IOException
-
addCheckpointListener
- Specified by:
addCheckpointListenerin interfaceOWriteAheadLog
-
removeCheckpointListener
- Specified by:
removeCheckpointListenerin interfaceOWriteAheadLog
-
getFlushedLsn
- Specified by:
getFlushedLsnin interfaceOWriteAheadLog
-
end
- Specified by:
endin interfaceOWriteAheadLog
-
executeWriteRecords
public void executeWriteRecords(boolean forceSync, boolean fullWrite)
-