public class ReadChangeStreamPartitionRangeTracker
extends org.apache.beam.sdk.transforms.splittabledofn.OffsetRangeTracker
OffsetRangeTracker. It modifies the
behaviour of OffsetRangeTracker.tryClaim(Long) to ignore claims for the same long
multiple times. This is because several change stream records might have the same timestamp, thus
leading to multiple claims of the same Long. Other than that, it modifies the OffsetRangeTracker.trySplit(double) method to always deny splits for the InitialPartition.PARTITION_TOKEN, since we only need to perform this query once.org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker.HasProgress, org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker.IsBounded, org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker.Progress, org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker.TruncateResult<RestrictionT>| Constructor and Description |
|---|
ReadChangeStreamPartitionRangeTracker(PartitionMetadata partition,
org.apache.beam.sdk.io.range.OffsetRange range)
Receives the partition that will be queried and be using this tracker, alongside the range
itself.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
tryClaim(java.lang.Long i)
Attempts to claim the given offset.
|
org.apache.beam.sdk.transforms.splittabledofn.SplitResult<org.apache.beam.sdk.io.range.OffsetRange> |
trySplit(double fractionOfRemainder)
If the partition token is the
InitialPartition.PARTITION_TOKEN, it does not allow for
splits (returns null). |
public ReadChangeStreamPartitionRangeTracker(PartitionMetadata partition, org.apache.beam.sdk.io.range.OffsetRange range)
partition - the partition that will use the trackerrange - closed / open range interval representing the start / end times for a partitionpublic boolean tryClaim(java.lang.Long i)
Must be equal or larger than the last successfully claimed offset.
tryClaim in class org.apache.beam.sdk.transforms.splittabledofn.OffsetRangeTrackertrue if the offset was successfully claimed, false if it is outside the
current OffsetRange of this tracker (in that case this operation is a no-op).public org.apache.beam.sdk.transforms.splittabledofn.SplitResult<org.apache.beam.sdk.io.range.OffsetRange> trySplit(double fractionOfRemainder)
InitialPartition.PARTITION_TOKEN, it does not allow for
splits (returns null).trySplit in class org.apache.beam.sdk.transforms.splittabledofn.OffsetRangeTracker