Class CommitLogReplayer

    • Field Detail

      • MAX_OUTSTANDING_REPLAY_BYTES

        public static long MAX_OUTSTANDING_REPLAY_BYTES
      • sawCDCMutation

        protected boolean sawCDCMutation
    • Method Detail

      • replayPath

        public void replayPath​(File file,
                               boolean tolerateTruncation)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • replayFiles

        public void replayFiles​(File[] clogs)
                         throws java.io.IOException
        Throws:
        java.io.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​(java.lang.Iterable<SSTableReader> onDisk,
                                                                        CommitLogPosition truncatedAt,
                                                                        java.util.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

        public static CommitLogPosition firstNotCovered​(java.util.Collection<IntervalSet<CommitLogPosition>> ranges)
        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

        protected boolean pointInTimeExceeded​(Mutation fm)
      • handleMutation

        public void handleMutation​(Mutation m,
                                   int size,
                                   int entryLocation,
                                   CommitLogDescriptor desc)
        Description copied from interface: CommitLogReadHandler
        Process a deserialized mutation
        Specified by:
        handleMutation in interface CommitLogReadHandler
        Parameters:
        m - deserialized mutation
        size - serialized size of the mutation
        entryLocation - filePointer offset inside the CommitLogSegment for the end of the record
        desc - CommitLogDescriptor for mutation being processed
      • shouldSkipSegmentOnError

        public boolean shouldSkipSegmentOnError​(CommitLogReadHandler.CommitLogReadException exception)
                                         throws java.io.IOException
        Description copied from interface: CommitLogReadHandler
        Handle 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:
        shouldSkipSegmentOnError in interface CommitLogReadHandler
        Parameters:
        exception - CommitLogReadException w/details on exception state
        Returns:
        boolean indicating whether to stop reading
        Throws:
        java.io.IOException - In the event the handler wants forceful termination of all processing, throw IOException.
      • handleUnrecoverableError

        public void handleUnrecoverableError​(CommitLogReadHandler.CommitLogReadException exception)
                                      throws java.io.IOException
        The logic for whether or not we throw on an error is identical for the replayer between recoverable or non.
        Specified by:
        handleUnrecoverableError in interface CommitLogReadHandler
        Parameters:
        exception - CommitLogReadException w/details on exception state
        Throws:
        java.io.IOException