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

Deepcopy combine_fn in PrecombineFn and PostCombineFn. #32598

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

claudevdm
Copy link
Contributor

@claudevdm claudevdm commented Sep 30, 2024

Deepcopy combine_fn in PrecombineFn and PostCombineFn to avoid sharing state between lifted stages when using cloudpickle.

Previously PrecombineFn and PostCombineFn assign setup, create_accumulator attributes as references the setup, create_accumulator methods on the original combine_fn [1] passed to _CombinePerKeyWithHotKeyFanout.

When using cloudpickler with combiner lifting Precombine is split into ExtractOutputs/Merge stages in the case of FnApiRunner and as a result if these stages run in the same process the state is shared. Similarly when the BundleBasedDirectRunner is used the Precombine is split into PartialGroupByKeyCombiningValues and FinishCombine, both invoking the setup [2][3] and teardown method.

This change ensures a new instance of the combine_fn is used in the lifted stages when using cloudpickler.

[1]

setup = combine_fn.setup

[2]
[3]


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.

@tvalentyn
Copy link
Contributor

This looks good to me. I would also test that the failure is no longer reproducible on Dataflow (it might require running a tests similar to existing unit test on Dataflow first, to repro the bug without changes.)

@tvalentyn tvalentyn marked this pull request as ready for review October 1, 2024 19:49
@tvalentyn tvalentyn merged commit eaf53e5 into apache:master Oct 1, 2024
91 of 92 checks passed
@claudevdm
Copy link
Contributor Author

fixes #26209

@robertwb
Copy link
Contributor

robertwb commented Oct 2, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants