Repository navigation
[Flink] Spill buffered GroupByKey values to disk in SortedBatchCombineOperator - #41909
Draft
pkuzmickas wants to merge 1 commit into
Draft
pkuzmickas wants to merge 1 commit into
pkuzmickas wants to merge 1 commit into
Conversation
…eOperator Co-Authored-By: Xirp Agent (gemini-4-neon) <xirp-agent@users.noreply.ghe.spotify.net>
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 #40607. Follow-up to #40611.
SortedBatchCombineOperator.BufferingCombinercollects all values for the currentGroupByKeykey into an unbounded on-heapArrayListbefore emitting the key. For pipelines with large keys (for example sorted-bucket writes grouping millions of records per bucket key), holding every deserialized value on heap across concurrent task slots causes heavy GC pressure orOutOfMemoryError: Java heap space, especially when a chained downstream operator also buffers per-key state on heap.What changes
SortedBatchCombineOperator.BufferingCombinerto accept the valueCoder:< 256elements) stay in a plainArrayListwith no serialization overhead.16 MiBdefault) returned as a re-iterableEncodedIterable.IOManagerspilling directory (falling back to the default temp directory when unavailable) and return a re-iterableSpilledIterablebacked by buffered file reads.open(@Nullable File spillDirectory)andclose()lifecycle hooks onKeyCombinerand invoke them fromSortedBatchCombineOperator#openand#close. Track live spill files with aReferenceQueueso consumed keys are deleted before task completion, and deterministically close any open streams and delete remaining spill files onclose().accumulatorCoderintoBufferingCombinerinFlinkStreamingAggregationsTranslators#batchGroupByKey.SortedBatchCombineOperatorTestcovering in-memory, compact-encoded, and disk-spilled keys, re-iteration, partial iteration, and spill cleanup on normal close and abort.🤖 Generated with Xirp Agent