[Spark] Support splittable DoFn self-checkpointing in portable batch - #39331
Open
Eliaaazzz wants to merge 1 commit into
Open
[Spark] Support splittable DoFn self-checkpointing in portable batch#39331Eliaaazzz wants to merge 1 commit into
Eliaaazzz wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #39331 +/- ##
=========================================
Coverage 54.76% 54.76%
Complexity 1716 1716
=========================================
Files 1066 1066
Lines 169075 169075
Branches 1255 1255
=========================================
+ Hits 92589 92591 +2
+ Misses 74269 74267 -2
Partials 2217 2217
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Eliaaazzz
force-pushed
the
spark-portable-sdf
branch
2 times, most recently
from
July 15, 2026 14:25
17df8a3 to
d99c843
Compare
Eliaaazzz
force-pushed
the
spark-portable-sdf
branch
from
July 27, 2026 13:40
d99c843 to
17970a7
Compare
The portable Spark runner never passed a BundleCheckpointHandler to StageBundleFactory.getBundle, so a splittable DoFn that self-checkpoints failed on its first bundle and could not run at all. In batch, a stage containing a splittable DoFn now holds each residual in memory under a processing time timer, the way the portable Flink batch runner does. Once the stage has drained its inputs, processing time advances to infinity and the held residuals are replayed until the SDK stops asking to resume, so a bounded restriction always runs out. Streaming keeps rejecting self-checkpointing, with a message naming the issue, since a residual has nowhere to live across micro-batches. Bundle finalization is likewise rejected rather than run early, since this runner cannot report that a bundle's output is durably committed. Unskips the bounded splittable DoFn tests for the Spark runner.
Eliaaazzz
force-pushed
the
spark-portable-sdf
branch
from
August 2, 2026 15:03
17970a7 to
6d61105
Compare
Eliaaazzz
marked this pull request as ready for review
August 2, 2026 15:03
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Contributor
|
Assigning reviewers: R: @jrmccluskey for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #19468 for batch.
The problem
The portable Spark runner never passed a
BundleCheckpointHandlertoStageBundleFactory.getBundle, so a splittable DoFn that returnsProcessContinuation.resume()failed on its first bundle. Several SDF tests were skipped for this runner as a result.The change
A batch stage containing a splittable DoFn now holds each residual in memory under a processing time timer, using the existing
BundleCheckpointHandlers.StateAndTimerBundleCheckpointHandlerwithInMemoryTimerInternalsandInMemoryStateInternals. This is the same model the portable Flink batch runner uses inFlinkExecutableStageFunction. Once the stage has drained its inputs, processing time advances to infinity and the held residuals are replayed until the SDK stops asking to resume, so a bounded restriction always runs out.In the branch that also has user timers, the two drains alternate, since a replayed residual could set a timer and a fired timer could produce a residual. The fuser does not appear to produce a stage holding both today, so that loop is defensive.
What is deliberately still unsupported
UsesUnboundedSplittableParDostays excluded andtest_unbounded_source_readstays skipped.InMemoryFinalizeris documented to run after the runner has durably committed the bundle's output, which this runner cannot report. The portable Flink batch runner rejects it the same way.UsesBundleFinalizerstays excluded.I had an earlier revision of this PR that also added a driver-side relay to carry residuals across micro-batches in streaming. I took it out: it depended on the staged RDD executing exactly once, which
persist(MEMORY_ONLY)does not guarantee, and its watermark could stall for a stage that emits output without ever checkpointing. That is worth doing properly rather than approximately, so it is left for follow-up.Testing
SparkExecutableStageFunctionTest.sdfResidualsAreReplayedUntilDraineddrives a stage whose first bundle self-checkpoints with one residual and whose replay bundle returns none, and asserts that the original element and then the residual both reach the input receiver. It fails if the replay loop is short-circuited.Unskips the bounded SDF tests in
spark_runner_test.pyand removes theUsesBoundedSplittableParDoexclusion from the portable ValidatesRunner task.Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).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.mdwith 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