Class CommitLogReplayer
java.lang.Object
org.apache.cassandra.db.commitlog.CommitLogReplayer
- All Implemented Interfaces:
CommitLogReadHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from interface org.apache.cassandra.db.commitlog.CommitLogReadHandler
CommitLogReadHandler.CommitLogReadErrorReason, CommitLogReadHandler.CommitLogReadException -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintFlushes all keyspaces associated with this replayer in parallel, blocking until their flushes are complete.static CommitLogReplayerstatic CommitLogPositionFind the earliest commit log position that is not covered by the known flushed ranges for some table.voidhandleMutation(Mutation m, int size, int entryLocation, CommitLogDescriptor desc) Process a deserialized mutationvoidThe logic for whether or not we throw on an error is identical for the replayer between recoverable or non.static IntervalSet<CommitLogPosition>persistedIntervals(Iterable<SSTableReader> onDisk, CommitLogPosition truncatedAt, UUID localhostId) A set of known safe-to-discard commit log replay positions, based on the range covered by on disk sstables and those prior to the most recent truncation recordprotected booleanvoidreplayFiles(File[] clogs) voidreplayPath(File file, boolean tolerateTruncation) booleanHandle an error during segment read, signaling whether or not you want the reader to skip the remainder of the current segment on error.
-
Field Details
-
MAX_OUTSTANDING_REPLAY_BYTES
public static long MAX_OUTSTANDING_REPLAY_BYTES -
mutationInitiator
-
sawCDCMutation
protected boolean sawCDCMutation -
commitLogReader
-
-
Method Details
-
construct
-
replayPath
- Throws:
IOException
-
replayFiles
- Throws:
IOException
-
blockForWrites
public int blockForWrites()Flushes all keyspaces associated with this replayer in parallel, blocking until their flushes are complete.- Returns:
- the number of mutations replayed
-
persistedIntervals
public static IntervalSet<CommitLogPosition> persistedIntervals(Iterable<SSTableReader> onDisk, CommitLogPosition truncatedAt, UUID localhostId) A set of known safe-to-discard commit log replay positions, based on the range covered by on disk sstables and those prior to the most recent truncation record -
firstNotCovered
Find the earliest commit log position that is not covered by the known flushed ranges for some table. For efficiency this assumes that the first contiguously flushed interval we know of contains the moment that the given table was constructed* and hence we can start replay from the end of that interval. If such an interval is not known, we must replay from the beginning. * This is not true only until if the very first flush of a table stalled or failed, while the second or latter succeeded. The chances of this happening are at most very low, and if the assumption does prove to be incorrect during replay there is little chance that the affected deployment is in production. -
pointInTimeExceeded
-
handleMutation
Description copied from interface:CommitLogReadHandlerProcess a deserialized mutation- Specified by:
handleMutationin interfaceCommitLogReadHandler- Parameters:
m- deserialized mutationsize- serialized size of the mutationentryLocation- filePointer offset inside the CommitLogSegment for the end of the recorddesc- CommitLogDescriptor for mutation being processed
-
shouldSkipSegmentOnError
public boolean shouldSkipSegmentOnError(CommitLogReadHandler.CommitLogReadException exception) throws IOException Description copied from interface:CommitLogReadHandlerHandle an error during segment read, signaling whether or not you want the reader to skip the remainder of the current segment on error.- Specified by:
shouldSkipSegmentOnErrorin interfaceCommitLogReadHandler- Parameters:
exception- CommitLogReadException w/details on exception state- Returns:
- boolean indicating whether to stop reading
- Throws:
IOException- In the event the handler wants forceful termination of all processing, throw IOException.
-
handleUnrecoverableError
public void handleUnrecoverableError(CommitLogReadHandler.CommitLogReadException exception) throws IOException The logic for whether or not we throw on an error is identical for the replayer between recoverable or non.- Specified by:
handleUnrecoverableErrorin interfaceCommitLogReadHandler- Parameters:
exception- CommitLogReadException w/details on exception state- Throws:
IOException
-