Class ParallelSnapshotReader.ParallelHaltingPredicate

  • All Implemented Interfaces:
    HaltingPredicate
    Enclosing class:
    ParallelSnapshotReader

    static class ParallelSnapshotReader.ParallelHaltingPredicate
    extends Object
    implements HaltingPredicate
    A Halting Predicate for the parallel snapshot reader. Usage for this predicate assumes two readers using two ParallelHalting Predicates. The booleans are owned by the two predicates, and keep track of whether they or the other reader has reached the end of the binlog. Test returns false if both both readers have been determined to be near the end of the binlog. Being near the end of the binlog is determined to be this predicate having seen a record with a timestamp within DEFAULT_MIN_HALTING_DURATION of the current time. Once a single record near the end of the binlog has been seen, we we assume the reader will stay near the end of the binlog.
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • DEFAULT_MIN_HALTING_DURATION

        private static final Duration DEFAULT_MIN_HALTING_DURATION
      • thisReaderNearEnd

        private volatile AtomicBoolean thisReaderNearEnd
      • otherReaderNearEnd

        private volatile AtomicBoolean otherReaderNearEnd
      • minHaltingDuration

        private final Duration minHaltingDuration
    • Method Detail

      • accepts

        public boolean accepts​(org.apache.kafka.connect.source.SourceRecord ourSourceRecord)
        Description copied from interface: HaltingPredicate
        Whether this record should be processed by the calling reader or not.
        Specified by:
        accepts in interface HaltingPredicate