You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "igorbernstein2 (via GitHub)" <gi...@apache.org> on 2024/09/13 18:25:25 UTC

[PR] fix: ensure that all outstanding future have completed in FinishBundle [beam]

igorbernstein2 opened a new pull request, #32454:
URL: https://github.com/apache/beam/pull/32454

   Previously this was done as a side effect of batcher.close. Now we explicitly ensure that all element future have been resolved and any handler errors are propagated
   
   **Please** add a meaningful description for your change here
   
   ------------------------
   
   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)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/workflows/Go%20tests/badge.svg?branch=master&event=schedule)](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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #32454:
URL: https://github.com/apache/beam/pull/32454#issuecomment-2350023206

   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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "steveniemitz (via GitHub)" <gi...@apache.org>.
steveniemitz commented on code in PR #32454:
URL: https://github.com/apache/beam/pull/32454#discussion_r1759329803


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -1477,6 +1502,21 @@ public void finishBundle(FinishBundleContext c) throws Exception {
             throw e;
           }
         }
+
+        for (Future<?> f = outstandingWrites.poll(); f != null; f = outstandingWrites.poll()) {

Review Comment:
   Can you use `CompletableFuture.allOf` here instead and wait on that?



-- 
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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "steveniemitz (via GitHub)" <gi...@apache.org>.
steveniemitz commented on code in PR #32454:
URL: https://github.com/apache/beam/pull/32454#discussion_r1759324259


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -1377,25 +1386,38 @@ public void startBundle(StartBundleContext c) throws IOException {
       }
 
       badRecords = new HashSet<>();
+      outstandingWrites = new LinkedBlockingDeque<>();
     }
 
     @ProcessElement
     public void processElement(ProcessContext c, BoundedWindow window) throws Exception {
+      // burn down the completed futures to avoid unbounded memory growth
+      for (Future<?> f = outstandingWrites.peek();

Review Comment:
   I don't think we want this, doesn't this essentially remove batching?



-- 
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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "steveniemitz (via GitHub)" <gi...@apache.org>.
steveniemitz commented on code in PR #32454:
URL: https://github.com/apache/beam/pull/32454#discussion_r1759391805


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -1377,25 +1386,38 @@ public void startBundle(StartBundleContext c) throws IOException {
       }
 
       badRecords = new HashSet<>();
+      outstandingWrites = new LinkedBlockingDeque<>();
     }
 
     @ProcessElement
     public void processElement(ProcessContext c, BoundedWindow window) throws Exception {
+      // burn down the completed futures to avoid unbounded memory growth
+      for (Future<?> f = outstandingWrites.peek();

Review Comment:
   oh never mind yeah sorry I misread this, can you refactor it out into another method though?



-- 
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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "steveniemitz (via GitHub)" <gi...@apache.org>.
steveniemitz commented on code in PR #32454:
URL: https://github.com/apache/beam/pull/32454#discussion_r1759414756


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -1463,6 +1489,8 @@ private static boolean isDataException(Throwable e) {
 
     @FinishBundle
     public void finishBundle(FinishBundleContext c) throws Exception {
+      List<Throwable> elementErrors = new ArrayList<>();

Review Comment:
   this is unused now



-- 
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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "igorbernstein2 (via GitHub)" <gi...@apache.org>.
igorbernstein2 commented on code in PR #32454:
URL: https://github.com/apache/beam/pull/32454#discussion_r1759405192


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -1377,25 +1386,38 @@ public void startBundle(StartBundleContext c) throws IOException {
       }
 
       badRecords = new HashSet<>();
+      outstandingWrites = new LinkedBlockingDeque<>();
     }
 
     @ProcessElement
     public void processElement(ProcessContext c, BoundedWindow window) throws Exception {
+      // burn down the completed futures to avoid unbounded memory growth
+      for (Future<?> f = outstandingWrites.peek();

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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #32454:
URL: https://github.com/apache/beam/pull/32454#issuecomment-2350428382

   ## [Codecov](https://app.codecov.io/gh/apache/beam/pull/32454?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `88.23529%` with `2 lines` in your changes missing coverage. Please review.
   > Project coverage is 58.85%. Comparing base [(`1c30708`)](https://app.codecov.io/gh/apache/beam/commit/1c307088a8609a1771236c53cc730cb23a79c816?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`ba8d875`)](https://app.codecov.io/gh/apache/beam/commit/ba8d875646ebd15b6688286e1cd9914febf6caef?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/beam/pull/32454?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...rg/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java](https://app.codecov.io/gh/apache/beam/pull/32454?src=pr&el=tree&filepath=sdks%2Fjava%2Fio%2Fgoogle-cloud-platform%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fbeam%2Fsdk%2Fio%2Fgcp%2Fbigtable%2FBigtableIO.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9qYXZhL2lvL2dvb2dsZS1jbG91ZC1wbGF0Zm9ybS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvYmVhbS9zZGsvaW8vZ2NwL2JpZ3RhYmxlL0JpZ3RhYmxlSU8uamF2YQ==) | 88.23% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/beam/pull/32454?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #32454      +/-   ##
   ============================================
   + Coverage     57.32%   58.85%   +1.53%     
   - Complexity     1474     3072    +1598     
   ============================================
     Files           964     1127     +163     
     Lines        153294   173694   +20400     
     Branches       1076     3329    +2253     
   ============================================
   + Hits          87880   102234   +14354     
   - Misses        63214    68118    +4904     
   - Partials       2200     3342    +1142     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/beam/pull/32454/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [java](https://app.codecov.io/gh/apache/beam/pull/32454/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `69.85% <88.23%> (+1.27%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/32454?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #32454:
URL: https://github.com/apache/beam/pull/32454#issuecomment-2350437400

   Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @robertwb for label java.
   R: @johnjcasey 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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "steveniemitz (via GitHub)" <gi...@apache.org>.
steveniemitz merged PR #32454:
URL: https://github.com/apache/beam/pull/32454


-- 
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] fix: ensure that all outstanding future have completed in FinishBundle [beam]

Posted by "igorbernstein2 (via GitHub)" <gi...@apache.org>.
igorbernstein2 commented on code in PR #32454:
URL: https://github.com/apache/beam/pull/32454#discussion_r1759389965


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java:
##########
@@ -1377,25 +1386,38 @@ public void startBundle(StartBundleContext c) throws IOException {
       }
 
       badRecords = new HashSet<>();
+      outstandingWrites = new LinkedBlockingDeque<>();
     }
 
     @ProcessElement
     public void processElement(ProcessContext c, BoundedWindow window) throws Exception {
+      // burn down the completed futures to avoid unbounded memory growth
+      for (Future<?> f = outstandingWrites.peek();

Review Comment:
   Not sure what you mean? this shouldnt block anything or affect batching



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