Class DetectNewPartitionsAction
- java.lang.Object
-
- org.apache.beam.sdk.io.gcp.bigtable.changestreams.action.DetectNewPartitionsAction
-
@Internal public class DetectNewPartitionsAction extends java.lang.ObjectThis class processesDetectNewPartitionsDoFn.
-
-
Constructor Summary
Constructors Constructor Description DetectNewPartitionsAction(ChangeStreamMetrics metrics, MetadataTableDao metadataTableDao, org.joda.time.Instant endTime, GenerateInitialPartitionsAction generateInitialPartitionsAction, ResumeFromPreviousPipelineAction resumeFromPreviousPipelineAction, ProcessNewPartitionsAction processNewPartitionsAction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.beam.sdk.transforms.DoFn.ProcessContinuationrun(org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker<org.apache.beam.sdk.io.range.OffsetRange,java.lang.Long> tracker, org.apache.beam.sdk.transforms.DoFn.OutputReceiver<PartitionRecord> receiver, org.apache.beam.sdk.transforms.splittabledofn.ManualWatermarkEstimator<org.joda.time.Instant> watermarkEstimator, InitialPipelineState initialPipelineState)Perform the necessary steps to manage initial set of partitions and new partitions.
-
-
-
Constructor Detail
-
DetectNewPartitionsAction
public DetectNewPartitionsAction(ChangeStreamMetrics metrics, MetadataTableDao metadataTableDao, @Nullable org.joda.time.Instant endTime, GenerateInitialPartitionsAction generateInitialPartitionsAction, ResumeFromPreviousPipelineAction resumeFromPreviousPipelineAction, ProcessNewPartitionsAction processNewPartitionsAction)
-
-
Method Detail
-
run
public org.apache.beam.sdk.transforms.DoFn.ProcessContinuation run(org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker<org.apache.beam.sdk.io.range.OffsetRange,java.lang.Long> tracker, org.apache.beam.sdk.transforms.DoFn.OutputReceiver<PartitionRecord> receiver, org.apache.beam.sdk.transforms.splittabledofn.ManualWatermarkEstimator<org.joda.time.Instant> watermarkEstimator, InitialPipelineState initialPipelineState) throws java.lang.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:
com.google.protobuf.InvalidProtocolBufferException- if failing to process new partitionsjava.lang.Exception
-
-