You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "jackdingilian (via GitHub)" <gi...@apache.org> on 2024/04/16 15:28:58 UTC
[PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
jackdingilian opened a new pull request, #30995:
URL: https://github.com/apache/beam/pull/30995
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](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "jackdingilian (via GitHub)" <gi...@apache.org>.
jackdingilian commented on PR #30995:
URL: https://github.com/apache/beam/pull/30995#issuecomment-2059520558
Run Spotless PreCommit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "m-trieu (via GitHub)" <gi...@apache.org>.
m-trieu commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1579744865
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -2075,6 +2078,8 @@ static ReadChangeStream create() {
abstract @Nullable Boolean getCreateOrUpdateMetadataTable();
+ abstract @Nullable Duration getBacklogReplicationAdjustment();
Review Comment:
Can this be Optional<Duration> autovalue should support this
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/changestreams/dofn/ReadChangeStreamPartitionDoFn.java:
##########
@@ -63,15 +64,32 @@ public class ReadChangeStreamPartitionDoFn
private final DaoFactory daoFactory;
private final ChangeStreamMetrics metrics;
private final ActionFactory actionFactory;
+ private final Duration backlogReplicationAdjustment;
private SizeEstimator<KV<ByteString, ChangeStreamRecord>> sizeEstimator;
private ReadChangeStreamPartitionAction readChangeStreamPartitionAction;
+ private final JodaClock clock;
Review Comment:
See comment above about using Supplier
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/changestreams/dofn/JodaClock.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.bigtable.changestreams.dofn;
+
+import java.io.Serializable;
+import org.joda.time.Instant;
+
+/** Simple clock interface to get an instant in a test friendly way. */
+interface JodaClock extends Serializable {
Review Comment:
How about SerializableSupplier with type parameter
It can just extend Java Supplier interface
I.e
'''
@FunctionalInterface
interface SerializableSupplier<T> extends Supplier<T>
'''
Then instead of taking JodaClock as a parameter you can just take
'SerializableSupplier<Instant> clock'
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1579967239
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -2312,6 +2337,10 @@ public PCollection<KV<ByteString, ChangeStreamMutation>> expand(PBegin input) {
if (getCreateOrUpdateMetadataTable() != null) {
shouldCreateOrUpdateMetadataTable = getCreateOrUpdateMetadataTable();
}
+ Duration backlogReplicationAdjustment = getBacklogReplicationAdjustment();
Review Comment:
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "tonytanger (via GitHub)" <gi...@apache.org>.
tonytanger commented on PR #30995:
URL: https://github.com/apache/beam/pull/30995#issuecomment-2059634218
LGTM for bigtable review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #30995:
URL: https://github.com/apache/beam/pull/30995#issuecomment-2077864045
R: @Abacn for final approval
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "m-trieu (via GitHub)" <gi...@apache.org>.
m-trieu commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1579756936
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/changestreams/dofn/JodaClock.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.bigtable.changestreams.dofn;
+
+import java.io.Serializable;
+import org.joda.time.Instant;
+
+/** Simple clock interface to get an instant in a test friendly way. */
+interface JodaClock extends Serializable {
Review Comment:
SerializableSupplier extends Supplier, Serializable*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "jackdingilian (via GitHub)" <gi...@apache.org>.
jackdingilian commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1579832936
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -2075,6 +2078,8 @@ static ReadChangeStream create() {
abstract @Nullable Boolean getCreateOrUpdateMetadataTable();
+ abstract @Nullable Duration getBacklogReplicationAdjustment();
Review Comment:
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "jonfrench (via GitHub)" <gi...@apache.org>.
jonfrench commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1575177947
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -2259,6 +2264,26 @@ public ReadChangeStream withCreateOrUpdateMetadataTable(boolean shouldCreate) {
return toBuilder().setCreateOrUpdateMetadataTable(shouldCreate).build();
}
+ /**
+ * Returns a new {@link BigtableIO.ReadChangeStream} that removes the replication delay
Review Comment:
Suggestion:
"Returns a new {@link BigtableIO.ReadChangeStream} that overrides the replication delay adjustment duration with the provided duration."
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "jackdingilian (via GitHub)" <gi...@apache.org>.
jackdingilian commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1579832519
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/changestreams/dofn/JodaClock.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.gcp.bigtable.changestreams.dofn;
+
+import java.io.Serializable;
+import org.joda.time.Instant;
+
+/** Simple clock interface to get an instant in a test friendly way. */
+interface JodaClock extends Serializable {
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "jackdingilian (via GitHub)" <gi...@apache.org>.
jackdingilian commented on PR #30995:
URL: https://github.com/apache/beam/pull/30995#issuecomment-2059372211
@tonytanger for Bigtable review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #30995:
URL: https://github.com/apache/beam/pull/30995#issuecomment-2059501711
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #30995:
URL: https://github.com/apache/beam/pull/30995#issuecomment-2059664967
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).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "jackdingilian (via GitHub)" <gi...@apache.org>.
jackdingilian commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1579662393
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -2259,6 +2264,26 @@ public ReadChangeStream withCreateOrUpdateMetadataTable(boolean shouldCreate) {
return toBuilder().setCreateOrUpdateMetadataTable(shouldCreate).build();
}
+ /**
+ * Returns a new {@link BigtableIO.ReadChangeStream} that removes the replication delay
Review Comment:
Thanks, this is better. Updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "m-trieu (via GitHub)" <gi...@apache.org>.
m-trieu commented on code in PR #30995:
URL: https://github.com/apache/beam/pull/30995#discussion_r1579759094
##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -2312,6 +2337,10 @@ public PCollection<KV<ByteString, ChangeStreamMutation>> expand(PBegin input) {
if (getCreateOrUpdateMetadataTable() != null) {
shouldCreateOrUpdateMetadataTable = getCreateOrUpdateMetadataTable();
}
+ Duration backlogReplicationAdjustment = getBacklogReplicationAdjustment();
Review Comment:
Nit: if using Optional return type can just be
'= getBacklogReplicationAdjustment().orElse(DEFAULT_BACKLOG_REPLICATION_ADJUSTMENT);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add ReadChangeStream IO param to adjust backlog estimates for replication delay [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn merged PR #30995:
URL: https://github.com/apache/beam/pull/30995
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org