Skip to content
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

Merged
merged 1 commit into from Apr 29, 2024

Conversation

jackdingilian
Copy link
Contributor

ReadChangeStreamIO estimates the backlog (via getSize) for each partition using partitionLowWatermark * 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:

  • Mention the appropriate issue in your description (for example: 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, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

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)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@jackdingilian
Copy link
Contributor Author

@tonytanger for Bigtable review

Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@jackdingilian
Copy link
Contributor Author

Run Spotless PreCommit

@tonytanger
Copy link
Contributor

LGTM for bigtable review

Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @m-trieu for label java.
R: @shunping for label io.
R: @mutianf for label bigtable.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@@ -2075,6 +2078,8 @@ static ReadChangeStream create() {

abstract @Nullable Boolean getCreateOrUpdateMetadataTable();

abstract @Nullable Duration getBacklogReplicationAdjustment();
Copy link
Contributor

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

Copy link
Contributor Author

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.

@@ -2312,6 +2337,10 @@ public PCollection<KV<ByteString, ChangeStreamMutation>> expand(PBegin input) {
if (getCreateOrUpdateMetadataTable() != null) {
shouldCreateOrUpdateMetadataTable = getCreateOrUpdateMetadataTable();
}
Duration backlogReplicationAdjustment = getBacklogReplicationAdjustment();
Copy link
Contributor

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);

Copy link
Contributor

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

@jackdingilian jackdingilian force-pushed the autoscaler-replication branch 2 times, most recently from 07aedb4 to 19a55e2 Compare April 25, 2024 16:57
Copy link
Contributor

@m-trieu m-trieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for Java

Copy link
Contributor

R: @Abacn for final approval

@Abacn Abacn merged commit 0696d00 into apache:master Apr 29, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants