Class DetectNewPartitionsAction
java.lang.Object
org.apache.beam.sdk.io.gcp.bigtable.changestreams.action.DetectNewPartitionsAction
This class processes
DetectNewPartitionsDoFn
.-
Constructor Summary
ConstructorsConstructorDescriptionDetectNewPartitionsAction
(ChangeStreamMetrics metrics, MetadataTableDao metadataTableDao, Instant endTime, GenerateInitialPartitionsAction generateInitialPartitionsAction, ResumeFromPreviousPipelineAction resumeFromPreviousPipelineAction, ProcessNewPartitionsAction processNewPartitionsAction) -
Method Summary
Modifier and TypeMethodDescriptionrun
(RestrictionTracker<OffsetRange, Long> tracker, DoFn.OutputReceiver<PartitionRecord> receiver, ManualWatermarkEstimator<Instant> watermarkEstimator, InitialPipelineState initialPipelineState) Perform the necessary steps to manage initial set of partitions and new partitions.
-
Constructor Details
-
DetectNewPartitionsAction
public DetectNewPartitionsAction(ChangeStreamMetrics metrics, MetadataTableDao metadataTableDao, @Nullable Instant endTime, GenerateInitialPartitionsAction generateInitialPartitionsAction, ResumeFromPreviousPipelineAction resumeFromPreviousPipelineAction, ProcessNewPartitionsAction processNewPartitionsAction)
-
-
Method Details
-
run
public DoFn.ProcessContinuation run(RestrictionTracker<OffsetRange, Long> tracker, DoFn.OutputReceiver<PartitionRecord> receiver, ManualWatermarkEstimator<Instant> watermarkEstimator, InitialPipelineState initialPipelineState) throws ExceptionPerform the necessary steps to manage initial set of partitions and new partitions. Currently, we set to process new partitions every second.- Look up the initial list of partitions to stream if it's the very first run.
- On rest of the runs, try advancing watermark if needed.
- Update the metadata table with info about this DoFn.
- Check if this pipeline has reached the end time. Terminate if it has.
- Process new partitions and output them.
- Reconcile any Partitions that haven't been streaming for a long time
- Register callback to clean up processed partitions after bundle has been finalized.
- Parameters:
tracker
- offset tracker that simply increment by 1 every single runreceiver
- output new partitionswatermarkEstimator
- update watermark that is a representation of the low watermark of the entire beam pipeline- Returns:
DoFn.ProcessContinuation.resume()
with 1-second delay if the stream continues, otherwiseDoFn.ProcessContinuation.stop()
- Throws:
InvalidProtocolBufferException
- if failing to process new partitionsException
-