New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ReadChangeStream IO param to adjust backlog estimates for replication delay #30995
Conversation
@tonytanger for Bigtable review |
af5e147
to
36a9809
Compare
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
36a9809
to
d9182c3
Compare
Run Spotless PreCommit |
LGTM for bigtable review |
Assigning reviewers. If you would like to opt out of this review, comment R: @m-trieu for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
...a/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
Outdated
Show resolved
Hide resolved
d9182c3
to
ee8ebd3
Compare
@@ -2075,6 +2078,8 @@ static ReadChangeStream create() { | |||
|
|||
abstract @Nullable Boolean getCreateOrUpdateMetadataTable(); | |||
|
|||
abstract @Nullable Duration getBacklogReplicationAdjustment(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be Optional autovalue should support this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to leave this as is for consistency with other optional parameters. We already do a lot of defaulting in ReadChangeStreamIO.expand instead of pushing down optional params into the DoFns and setting defaults there.
I don't have a strong preference for either approach but I think we should keep this consistent with the other parameters.
...platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/changestreams/dofn/JodaClock.java
Outdated
Show resolved
Hide resolved
...va/org/apache/beam/sdk/io/gcp/bigtable/changestreams/dofn/ReadChangeStreamPartitionDoFn.java
Outdated
Show resolved
Hide resolved
@@ -2312,6 +2337,10 @@ public PCollection<KV<ByteString, ChangeStreamMutation>> expand(PBegin input) { | |||
if (getCreateOrUpdateMetadataTable() != null) { | |||
shouldCreateOrUpdateMetadataTable = getCreateOrUpdateMetadataTable(); | |||
} | |||
Duration backlogReplicationAdjustment = getBacklogReplicationAdjustment(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: if using Optional return type can just be
'= getBacklogReplicationAdjustment().orElse(DEFAULT_BACKLOG_REPLICATION_ADJUSTMENT);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullable is fine. For streaming IO a consideration is upgrade compatibility, and newly added parameters then need to be nullable and set default in pipeline submission
07aedb4
to
19a55e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for Java
R: @Abacn for final approval |
19a55e2
to
0130bf7
Compare
ReadChangeStreamIO estimates the backlog (via
getSize
) for each partition usingpartitionLowWatermark * partitionThroughtput
. The low watermark is held back by replication delay for replicated bigtable instances, which can cause the backlog to stay above the downscaling threshold even when the pipeline is 'caught up'This adds a parameter to adjust the backlog downwards based on an estimate of the replication delay. We default it to 30 seconds which testing has shown works well for replicated instances.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123
), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.