[flink] Route undo offsets by sink subtask - #3915
Merged
platinumhamburg merged 1 commit intoAug 12, 2026
Merged
Conversation
platinumhamburg
force-pushed
the
fix/undo-recovery-reporter-routing
branch
from
August 10, 2026 01:57
09a00c5 to
db47bd9
Compare
platinumhamburg
force-pushed
the
fix/undo-recovery-reporter-routing
branch
from
August 11, 2026 08:44
db47bd9 to
591bfdb
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes incorrect routing of Undo Recovery offset reports in the Flink sink when multiple sink subtasks run in the same JVM, by introducing subtask-scoped reporter keys and ownership-aware delegate unregistration to avoid cross-subtask (and delayed-close) interference.
Changes:
- Bind producer offset reporting to a
(reporterGroupId, subtaskIndex)key and register/remove delegates with ownership checks. - Plumb the runtime sink subtask index into sink writer creation so each writer creates a reporter for its own subtask.
- Add/extend unit tests covering routing correctness, delayed close behavior, and prevention of adding an Undo Recovery sink to multiple topologies.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/sink/undo/UndoRecoveryOperatorFactory.java | Introduces reporter group ID + subtask routing keys, a static delegate registry keyed by reporter key, and ownership-aware unregister. |
| fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/sink/undo/UndoRecoveryOperator.java | Derives reporter key from group ID + runtime subtask index; validates/fails fast on invalid offset reports; unregisters with ownership. |
| fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/sink/FlinkSink.java | Passes subtask index into writer construction and creates subtask-bound reporters from the stored operator factory. |
| fluss-flink/fluss-flink-common/src/main/java/org/apache/fluss/flink/adapter/SinkAdapter.java | Extends the adapter’s writer creation hook to include the runtime subtask index. |
| fluss-flink/fluss-flink-1.18/src/main/java/org/apache/fluss/flink/adapter/SinkAdapter.java | Same subtask-index plumbing for Flink 1.18 adapter variant. |
| fluss-flink/fluss-flink-2.2/src/main/java/org/apache/fluss/flink/adapter/SinkAdapter.java | Same subtask-index plumbing for Flink 2.2 adapter variant (using TaskInfo). |
| fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/sink/undo/UndoRecoveryOperatorFactoryTest.java | New tests asserting correct routing across subtasks, fail-fast behavior, and delayed-close safety. |
| fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/sink/FlussSinkBuilderTest.java | Adds a regression test ensuring an Undo Recovery-enabled sink builder isn’t reused across multiple topologies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Purpose
Linked issue: close #3914 3914
Brief change log
Tests
API and Format
Documentation