Repository navigation
[Fix][API] Forward restoreCommit to each table in MultiTableSinkAggregatedCommitter - #12807
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the contribution, and for the clear root-cause write-up and the end-to-end validation on the XA path. I went through the full diff and traced the restore call chain; the fix is correct and minimal. I did not find any blocking issues. Details below.
What Problem Does This PR Solve?
- User pain point: Under Zeta every sink is wrapped in
MultiTableSink, so on restore the engine callsMultiTableSinkAggregatedCommitter.restoreCommit. That class did not override it, so the interface default (SinkAggregatedCommitter.restoreCommit->commit) ran, and a per-table committer's ownrestoreCommitwas never reached. For the JDBC XA sink (JdbcSinkAggregatedCommitter.restoreCommit), this means already-committed XIDs get re-committed on restore, MySQL answersXAER_NOTA, and the job cannot restore. - Fix approach: Override
restoreCommitinMultiTableSinkAggregatedCommitterand route it to each table committer'srestoreCommit, reusing the existing per-table split/merge logic ofcommit()via a shared private helper. - One-sentence summary: Make the multi-table wrapper forward restore to the real per-table
restoreCommitinstead of silently downgrading it tocommit.
1. Code Change Review
1.1 Core Logic Analysis
Changed files / methods
seatunnel-api/.../multitablesink/MultiTableSinkAggregatedCommitter.java:commit()now delegates tocommitPerTable(info, false); newrestoreCommit()delegates tocommitPerTable(info, true); the loop body is unchanged except the single call siterestore ? sinkCommitter.restoreCommit(commitInfo) : sinkCommitter.commit(commitInfo)(lines ~72-110).seatunnel-api/.../MultiTableSinkAggregatedCommitterTest.java: newtestRestoreCommitRoutesToTableRestoreCommit.
Before / after (key lines)
// before: no restoreCommit override -> interface default -> commit()
List errCommitList = sinkCommitter.commit(commitInfo);
// after
List errCommitList =
restore
? sinkCommitter.restoreCommit(commitInfo)
: sinkCommitter.commit(commitInfo);Complete runtime path
Job restore from checkpoint (-r)
-> SinkAggregatedCommitterTask.restoreState(actionStateList)
[seatunnel-engine-server/.../SinkAggregatedCommitterTask.java:259-278]
-> deserialize MultiTableAggregatedCommitInfo from checkpoint state
-> aggregatedCommitter.restoreCommit(infos) // aggregatedCommitter == MultiTableSinkAggregatedCommitter under Zeta
BEFORE: not overridden -> SinkAggregatedCommitter.restoreCommit default [SinkAggregatedCommitter.java:42-45]
-> MultiTableSinkAggregatedCommitter.commit -> table.commit() (XA: re-commit committed XIDs -> XAER_NOTA)
AFTER: MultiTableSinkAggregatedCommitter.restoreCommit -> commitPerTable(infos, true)
-> for each sinkIdentifier: pick that table's info from each MultiTableAggregatedCommitInfo
-> table.restoreCommit(perTableInfo)
-> JdbcSinkAggregatedCommitter.restoreCommit [JdbcSinkAggregatedCommitter.java:97-105]
(reconciles checkpoint XIDs against the RM recovery scan, skips already-resolved ones)
-> non-empty returned list -> CheckpointException(AGGREGATE_COMMIT_ERROR) [SinkAggregatedCommitterTask.java:275-279]
Key findings
- The normal restore path does hit this code:
SinkAggregatedCommitterTask.restoreStatecallsrestoreCommiton the committer, and under Zeta that committer is the multi-table wrapper. So this is a main-path fix for restore, not only an edge case. - The change is a precise fix. The per-table split, the error-list merge and the return contract are shared by both entry points through
commitPerTable, socommit()behavior is unchanged (restore=falseselects the same call as before). - For sinks that do not override
restoreCommit,sinkCommitter.restoreCommit(...)resolves to the interface default and callscommit(...), so the effective behavior is identical to today. - I confirmed the only other connector committer overriding
restoreCommitis Iceberg (IcebergAggregatedCommitter.java:64-79). Under Zeta it was previously also bypassed by the wrapper; after this PR its own restore logic (isAlreadyCommittedcheck, thencommitFiles) will start to run on restore. That is the intended contract ofrestoreCommitand looks correct to me, just worth being aware of as a user-visible side effect beyond JDBC.
1.2 Compatibility Impact
Fully compatible.
- APIs / SPI: no signature change;
restoreCommitalready exists onSinkAggregatedCommitter, this only overrides it in the wrapper. - Config options and defaults: unchanged.
- Serialization / checkpoint format: unchanged (
MultiTableAggregatedCommitInfois read and written exactly as before). - Historical behavior: unchanged for sinks without a custom
restoreCommit. For JDBC XA and Iceberg, behavior changes from "restore bypassed to commit" to the documentedrestoreCommitsemantics, which is the bug being fixed. Noincompatible-changes.mdentry is needed.
1.3 Performance / Side-Effect Analysis
- CPU / memory / GC: one extra boolean parameter and a ternary; no new allocations or per-record work. The path runs only once per restore.
- Networking / locks / concurrency: no new threads, locks or shared state.
restoreStateis already invoked once per committer task. - Retries / idempotency: this change improves idempotency on restore for XA/Iceberg, since their
restoreCommitalready encodes the "skip already resolved" logic. - Resource release: unchanged.
1.4 Error Handling and Logging
- A non-empty list returned from the per-table
restoreCommitis merged intoerrorListexactly as forcommit(), andSinkAggregatedCommitterTask.restoreStatestill converts a non-empty result intoCheckpointException(AGGREGATE_COMMIT_ERROR). No exceptions are swallowed and no logging changes. - Exceptions thrown by a table's
restoreCommit(for example the JDBCJdbcConnectorException) propagate unchanged, as they do forcommit().
No blocking issues found.
2. Code Quality Assessment
2.1 Coding Standards
The change follows the existing style, keeps the diff small, and adds an explanatory comment for the new override that states why the override is needed. commitPerTable is a private helper with a self-explanatory name; I do not consider additional Javadoc mandatory there.
2.2 Test Coverage and Test Stability
testRestoreCommitRoutesToTableRestoreCommitbuilds a table committer that records which entry point is called, then callsrestoreCommitandcommiton the wrapper. It would fail if the override were removed (the call would be recorded ascommit[xid-1]), and it also guards againstcommit()accidentally being routed torestoreCommit. That covers the root-cause behavior directly.- Stability rating: Stable. The test is single-threaded and in-memory, has no sleeps, ports, or external resources, and asserts an ordered list that is deterministic (
MultiTableSinkAggregatedCommitterTest.java:74-116). - Optional, non-blocking: the test uses a single table, so it does not exercise the per-table split with two table identifiers, nor the merged error list returned from
restoreCommit. A second table in the same test (and one returning a non-empty list fromrestoreCommit) would pin the "same per-table split as commit()" claim in the PR description. Not required for merge.
2.3 Documentation Updates
No user-visible option or configuration changed, so docs/en and docs/zh do not need updates.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. The defect is exactly that the wrapper did not forward a lifecycle method that the interface lets sinks specialize; forwarding it at the wrapper is the right layer (the engine task stays connector-agnostic).
3.2 Maintainability
Clear. Sharing one loop between commit and restoreCommit avoids copy-paste drift. A boolean flag parameter is slightly less readable than two thin lambdas or an enum, but for a private two-caller helper it is fine.
3.3 Extensibility
Any future connector that overrides restoreCommit will now work under Zeta without wrapper changes. As a side thought for a follow-up (not for this PR): other SinkAggregatedCommitter default-method forwards in wrappers could be audited the same way.
3.4 Historical-Version Compatibility
Compatible with existing checkpoints and with previously saved jobs; no state format or option change, no upgrade action needed.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| - | No blocking issues found | - | - |
Optional suggestion (non-blocking, not numbered): extend the new test with a second table and a non-empty error-list return from restoreCommit.
5. Merge Recommendation
Conclusion: Ready to merge
-
Blockers - must be fixed
- None on the source side.
-
Recommended fixes - non-blocking
- Optionally broaden the unit test to two tables and the error-list path, as described above. It does not block merge because the existing test already fails without the override and the shared loop is unchanged.
CI / merge gate: at the time of this review the Build check for head f3e7a8b was still queued (the real signal runs in the contributor's fork; the run is https://github.com/ricky2129/seatunnel/actions/runs/38750864232). The branch is also 1 commit behind dev, which is only a metadata observation and not a request to rebase. Please make sure the fork run completes green; once it does I do not see anything else standing in the way.
Overall assessment: A small, correct, well-tested fix for a real restore failure on the JDBC XA path under Zeta. I do not see a better alternative location for the fix. Thanks again for tracking this down!
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update, and for keeping the branch in sync with dev. I re-reviewed the new head f3891ac. Nothing in the PR's own change moved since my previous round on f3e7a8b: the last two commits are merges of dev only, and the PR's net diff against dev is still just the two files below. My earlier conclusion stands, and I have no new findings.
What Problem Does This PR Solve?
- User pain point: Under Zeta every sink runs inside
MultiTableSink, so on restore the engine callsMultiTableSinkAggregatedCommitter.restoreCommit. The wrapper did not override it, so the interface default (commit) ran and a table committer's ownrestoreCommitwas never reached. For the JDBC XA sink this re-commits already-committed XIDs, MySQL answersXAER_NOTA, and the job cannot restore. - Fix approach: Override
restoreCommitin the wrapper and route it to each table committer'srestoreCommit, sharing the per-table split/merge loop withcommit()through a private helper. - One-sentence summary: The multi-table wrapper now forwards restore to the real per-table
restoreCommitinstead of silently downgrading it tocommit.
1. Code Change Review
1.1 Core Logic Analysis
Net PR diff against current dev (re-verified on this head):
seatunnel-api/.../multitablesink/MultiTableSinkAggregatedCommitter.java:commit()delegates tocommitPerTable(info, false); newrestoreCommit()delegates tocommitPerTable(info, true); the only behavioral line isrestore ? sinkCommitter.restoreCommit(commitInfo) : sinkCommitter.commit(commitInfo).seatunnel-api/.../MultiTableSinkAggregatedCommitterTest.java: newtestRestoreCommitRoutesToTableRestoreCommit.
Runtime path: SinkAggregatedCommitterTask.restoreState -> aggregatedCommitter.restoreCommit(infos) (the multi-table wrapper under Zeta) -> commitPerTable(infos, true) -> each table's restoreCommit (for example JdbcSinkAggregatedCommitter.restoreCommit). This is the normal restore path, not an edge case. For sinks that do not override restoreCommit, the interface default still calls commit, so their behavior is unchanged. A side effect worth knowing about: Iceberg's restoreCommit was also bypassed before and will now run on restore, which is the intended contract.
The extra files that appear when comparing the two heads directly (AGENTS.md, CLAUDE.md symlink removal, the multi_table_sink_replica check in MultiTableSink) come from dev (#12568, #12811) and are not part of this PR.
1.2 Compatibility Impact
Fully compatible. No API/SPI signature, option, default or checkpoint serialization change. MultiTableAggregatedCommitInfo is read and written as before. No incompatible-changes.md entry needed.
1.3 Performance / Side-Effect Analysis
One boolean and a ternary on a path that runs once per restore. No new threads, locks, allocations in hot paths or resources. Idempotency on restore improves for XA and Iceberg.
1.4 Error Handling and Logging
Non-empty per-table results are merged into the error list exactly as for commit(), and restoreState still converts a non-empty result into CheckpointException. Exceptions propagate unchanged; nothing is swallowed.
No blocking issues found.
2. Code Quality Assessment
2.1 Coding Standards
Small, consistent with the file's style, and the new override carries a comment explaining why it exists.
2.2 Test Coverage and Test Stability
testRestoreCommitRoutesToTableRestoreCommit records which entry point each table committer receives and asserts restoreCommit[xid-1] then commit[xid-1]. It turns red if the override is removed or if commit() is mis-routed. Stability rating: Stable (single-threaded, in-memory, no sleeps, ports or external resources; deterministic ordered assertion at MultiTableSinkAggregatedCommitterTest.java around lines 74-116).
Optional, non-blocking: add a second table and a non-empty error list returned from restoreCommit to pin the "same per-table split as commit()" claim.
2.3 Documentation Updates
No user-visible option changed, so docs/en and docs/zh need no update.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix, at the right layer: the wrapper forwards a lifecycle method that sinks may specialize, and the engine task stays connector-agnostic.
3.2 Maintainability
Clear; one shared loop avoids copy-paste drift. The boolean flag is slightly less readable than two lambdas, but fine for a private two-caller helper.
3.3 Extensibility
Future connectors that override restoreCommit will work under Zeta without further wrapper changes.
3.4 Historical-Version Compatibility
Compatible with existing checkpoints and saved jobs; no upgrade action needed.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| - | No blocking issues found | - | - |
5. Merge Recommendation
Conclusion: Ready to merge
-
Blockers - must be fixed
- None.
-
Recommended fixes - non-blocking
- Optionally broaden the unit test to two tables and the error-list path. It does not block merge because the existing test already fails without the override.
CI / merge gate: at the time of this review the Build check on head f3891ac is still in progress (the real signal runs in the contributor's fork), so I am not approving yet. The branch is ahead of dev with no conflicts (behind_by=0). Once the fork run finishes green, I do not see anything else standing in the way.
Overall assessment: A small, correct, well-tested fix for a real restore failure on the JDBC XA path under Zeta. Thanks again!
SEZ9
left a comment
There was a problem hiding this comment.
Thanks for working on this. I reviewed the latest head 73f6621c27ce.
What this PR fixes
- User pain: On Zeta restore,
SinkAggregatedCommitterTask.restoreStatecallsMultiTableSinkAggregatedCommitter.restoreCommit, which fell through to theSinkAggregatedCommitterdefault (return commit(aggregatedCommitInfo)), so a connector's ownrestoreCommit-- notably the prepared-XID reconciliation inJdbcSinkAggregatedCommitter.restoreCommit-- was unreachable and XA restores re-committed already-committed XIDs and failed withXAER_NOTA. - Fix approach:
MultiTableSinkAggregatedCommitternow overridesrestoreCommit(MultiTableSinkAggregatedCommitter.java:81-83,return commitPerTable(aggregatedCommitInfo, true));commitandrestoreCommitsharecommitPerTable(..., boolean restore), which keeps the existing per-table split and positional error-list merge and dispatchesrestore ? sinkCommitter.restoreCommit(commitInfo) : sinkCommitter.commit(commitInfo)(:102-105); a unit test asserts the restore call reaches the table committer'srestoreCommit, notcommit. - One-line summary: Small, correct, well-targeted fix for the Zeta restore path with a focused regression test; only Zeta drives
restoreCommit(the only production caller isSinkAggregatedCommitterTask.java:275), and the remaining points are non-blocking: the restore branch inherits the fail-fast, no-table-identifier loop and the rawListfromcommit(), the test covers one table with an empty retry list, the override also activatesIcebergAggregatedCommitter.restoreCommitunder Zeta for the first time, and the architecture doc still shows a stalerestoreCommitsignature.
Runtime chain I rechecked
SinkAggregatedCommitterTask.restoreState() SinkAggregatedCommitterTask.java:260
-> aggregatedCommitter.restoreCommit(aggregatedCommitInfos) SinkAggregatedCommitterTask.java:275
-> MultiTableSinkAggregatedCommitter.restoreCommit() MultiTableSinkAggregatedCommitter.java:81 [NEW override; previously SinkAggregatedCommitter.restoreCommit default -> commit() SinkAggregatedCommitter.java:42-44]
-> commitPerTable(aggregatedCommitInfo, true) MultiTableSinkAggregatedCommitter.java:83
-> per sinkIdentifier: split MultiTableAggregatedCommitInfo by table MultiTableSinkAggregatedCommitter.java:93-101
-> restore ? sinkCommitter.restoreCommit(commitInfo) : sinkCommitter.commit(commitInfo) MultiTableSinkAggregatedCommitter.java:102-105
-> JdbcSinkAggregatedCommitter.restoreCommit() JdbcSinkAggregatedCommitter.java:97
-> tryOpen(); replayRecoveredCheckpoint(xidInfoList, recoverCheckpointTransactions()) JdbcSinkAggregatedCommitter.java:99-104
-> positional merge of per-table retry lists into errorList MultiTableSinkAggregatedCommitter.java:110-115
-> if returned list non-empty: throw CheckpointException(AGGREGATE_COMMIT_ERROR) SinkAggregatedCommitterTask.java:276-278
Findings
Issue 1: restoreCommit fails fast on the first table that throws; remaining tables' in-doubt XA transactions stay prepared and the propagated exception carries no table identifier
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:104 - Why it matters: - Root cause:
commitPerTablehas no per-table error handling. Whenrestoreis true,sinkCommitter.restoreCommit(commitInfo)atMultiTableSinkAggregatedCommitter.java:104runs inside the plainforloop overaggCommitters.keySet(); the first exception from any table (for JDBC XA,JdbcSinkAggregatedCommitter.restoreCommitstarts withtryOpen(), which throwsJdbcConnectorExceptionwhen the XA facade cannot be opened, andreplayRecoveredCheckpointfails closed on XID gaps) unwinds the whole loop. The siblingabort()andclose()methods in this same class deliberately catch per table, log, keep the first throwable and rethrow after the loop. - Impact: now that this branch is what
SinkAggregatedCommitterTask.restoreState(SinkAggregatedCommitterTask.java:275) reaches, one failing table means every later table's prepared XA branches are never reconciled on that restore attempt, and the exception that surfaces does not say whichsinkIdentifierfailed, so the operator has to guess which target to inspect. - Fix: wrap the per-table dispatch in the same try/catch pattern
abort()uses -- log withsinkIdentifier, remember the first throwable, continue the loop, rethrow at the end (wrapping the identifier into the message). Applying it to both branches keepscommitandrestoreCommitconsistent; at minimum therestorebranch should get it. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:103 restore;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:104 ? sinkCommitter.restoreCommit(commitInfo);seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:105 : sinkCommitter.commit(commitInfo); - Suggested fix: Now that this branch is the one Zeta's
SinkAggregatedCommitterTask.restoreStatereaches, an exception from one table'srestoreCommit(e.g.JdbcSinkAggregatedCommitter.restoreCommit→tryOpen()or a fail-closed XID gap) aborts the loop and leaves every later table's prepared XA branches unreconciled, and the exception that surfaces does not name the table.abort()andclose()in this class already catch per table, log, keep the first throwable and rethrow after the loop. Could we apply the same pattern here (at least for therestorebranch), so one bad table does not block recovery of the others and the error namessinkIdentifier? - Severity: Medium
Issue 2: Architecture doc still shows a stale restoreCommit signature and says nothing about the multi-table wrapper forwarding it; this PR is what makes the hook reachable under Zeta, so the doc should be corrected alongside it
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:81 - Why it matters: - Root cause:
docs/en/architecture/api-design/sink-architecture.md:528-532documentsSinkAggregatedCommitter.restoreCommitasdefault void restoreCommit(List<AggregatedCommitInfoT> aggregatedCommitInfos) throws IOException {}with the description "Restore committer state from checkpoint". The real interface (seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkAggregatedCommitter.java:42-45) returnsList<AggregatedCommitInfoT>(the retry list) and defaults tocommit(aggregatedCommitInfo), and the new override atMultiTableSinkAggregatedCommitter.java:81-83is the piece that makes a connector'srestoreCommitreachable at all under Zeta. - Impact: a connector author following the doc would write a
voidmethod that does not override anything and would not learn that, under Zeta, theirrestoreCommitreceives only their own table's commit infos via the multi-table wrapper. - Fix: correct the signature and description in
sink-architecture.md:528-532to match the interface, and add a sentence noting thatMultiTableSinkAggregatedCommitterforwardsrestoreCommitper table. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:83 return commitPerTable(aggregatedCommitInfo, true);;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:81 public List<MultiTableAggregatedCommitInfo> restoreCommit(;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:82 List<MultiTableAggregatedCommitInfo> aggregatedCommitInfo) throws IOException { - Suggested fix: Since this override is what finally makes a connector's
restoreCommitreachable under Zeta, could you also fix the architecture doc in the same PR?docs/en/architecture/api-design/sink-architecture.md:531-532still showsdefault void restoreCommit(...) throws IOException {}, which is neither the real signature (it returnsList<AggregatedCommitInfoT>and defaults tocommit(...)) nor the real contract. A short note there thatMultiTableSinkAggregatedCommitterforwardsrestoreCommitper table (so a connector only sees its own table's commit infos) would save the next connector author from implementing a method that never overrides anything. - Severity: Medium
Issue 3: User-visible restore behaviour changes for JDBC XA and Iceberg under Zeta, but there is no release/upgrade note; the existing JDBC XA entry in incompatible-changes.md describes behaviour that was not actually reachable before this PR
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:104 - Why it matters: - Root cause:
commitPerTable(..., true)atMultiTableSinkAggregatedCommitter.java:102-105now dispatches tosinkCommitter.restoreCommit(commitInfo). On disk the only two production overrides areJdbcSinkAggregatedCommitter.restoreCommit(JdbcSinkAggregatedCommitter.java:97) andIcebergAggregatedCommitter.restoreCommit(IcebergAggregatedCommitter.java:64-78, which skips checkpoints wherefilesCommitter.isAlreadyCommitted(...)). Under Zeta neither was invoked before this PR because the wrapper fell through tocommit(). - Impact:
docs/en/introduction/concepts/incompatible-changes.md:187-193already describes the JDBC XA restore semantics (recovery-order evidence, fail-closed gaps) as if they were in effect, yet under Zeta they only take effect with this PR; Iceberg restores also start skipping already-committed checkpoints. Neither change is recorded anywhere a user upgrading would see it, and the PR description only mentions JDBC. - Fix: add a short entry under
## devinincompatible-changes.mdstating that the multi-table wrapper now forwardsrestoreCommit, so the JDBC XA restore semantics described there apply under Zeta and Iceberg restores skip already-committed checkpoints; mention Iceberg in the PR's user-facing-change section. - Suggested fix: This line is what activates both
JdbcSinkAggregatedCommitter.restoreCommitandIcebergAggregatedCommitter.restoreCommitunder Zeta for the first time (those are the only two production overrides in the tree).docs/en/introduction/concepts/incompatible-changes.md:187-193already describes the JDBC XA restore semantics as if they were in effect, so a one-line note under## devsaying the multi-table wrapper now forwardsrestoreCommit(and that Iceberg restores will skip already-committed checkpoints) would make the upgrade story consistent. Mentioning Iceberg in the PR description's user-facing section would help too. - Severity: Low
Issue 4: This override also activates IcebergAggregatedCommitter.restoreCommit under Zeta for the first time; the PR only validated JDBC XA, and the existing Iceberg savepoint IT ran while that code was unreachable
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:83 - Why it matters: - Root cause: the override at
MultiTableSinkAggregatedCommitter.java:80-84forwards to every table committer'srestoreCommit. Across the repo only two connectors override it:JdbcSinkAggregatedCommitter.restoreCommit(XID reconciliation) andIcebergAggregatedCommitter.restoreCommit(IcebergAggregatedCommitter.java:64-78:filesCommitter.isAlreadyCommitted(checkpointId, allResults)then skip orcommitFiles). - Impact: Zeta wraps sinks in
MultiTableSink, so until now Iceberg restores on Zeta went throughcommit()and re-rancommitFilesfor every checkpoint.IcebergSinkParallelCommitIT.testRecoveryFromSavepointProducesNoDuplicateSnapshots(IcebergSinkParallelCommitIT.java:261-265) is disabled on Spark and Flink, so it is Zeta-only and its Javadoc at line 249 says it exercisesIcebergAggregatedCommitter.restoreCommit()-- yet that method could not have executed on Zeta before this PR. This change is therefore the first time the IT actually drives theisAlreadyCommittedskip branch, and the PR's end-to-end validation covered only MySQL-CDC → JDBC XA. - Fix: run
connector-iceberg-e2eon this head and confirm the savepoint recovery test still passes withrestoreCommitgenuinely executing; add Iceberg to the user-facing-change section of the description. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:83 return commitPerTable(aggregatedCommitInfo, true); - Suggested fix: Worth noting in the description: besides JDBC XA, this also makes
IcebergAggregatedCommitter.restoreCommit(theisAlreadyCommittedskip) reachable on Zeta for the first time.IcebergSinkParallelCommitIT.testRecoveryFromSavepointProducesNoDuplicateSnapshotsis Zeta-only and its Javadoc says it exercises that method, but until this change the restore went throughcommit()instead -- so this PR is the first time it actually tests that branch. Please make sureconnector-iceberg-e2eis run on this head and add Iceberg to the user-facing-change section. - Severity: Low
Issue 5: The new test exercises a single table whose restoreCommit returns an empty list; the per-table split and the retry-list merge on the restore path are not covered
- Location:
seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitterTest.java:115 - Why it matters: - Root cause:
testRestoreCommitRoutesToTableRestoreCommitregisters one committer ("table1") and both stub methods returnCollections.emptyList(), so the assertion atMultiTableSinkAggregatedCommitterTest.java:114-115only proves the dispatch flag atMultiTableSinkAggregatedCommitter.java:102-105picks the right method. - Impact: the refactor moved the filtering (
.get(sinkIdentifier)+Objects::nonNull) and the positionalerrorListmerge (MultiTableSinkAggregatedCommitter.java:110-115) into the sharedcommitPerTable, andSinkAggregatedCommitterTask.restoreStateturns a non-empty return intoCheckpointException(AGGREGATE_COMMIT_ERROR). Nothing in this class checks that, on the restore path, each table committer only receives its own entries or that a table's returned retry list is re-keyed under the correctsinkIdentifier. - Fix: add a second case with two tables where
table1.restoreCommitreturns its input andtable2.restoreCommitreturns empty; assert each stub saw only its own entries and that the wrapper returns oneMultiTableAggregatedCommitInfowhose map contains onlytable1. - Evidence:
seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitterTest.java:115 Arrays.asList("restoreCommit[xid-1]", "commit[xid-1]"), calls);;seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitterTest.java:111 committer.restoreCommit(infos);;seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitterTest.java:114 Assertions.assertIterableEquals( - Suggested fix: Nice, this pins the routing bug. Since the PR also moves the per-table filtering and the
errorListmerge into the sharedcommitPerTable, it would be worth one more case in this class with two tables wheretable1.restoreCommitreturns its input andtable2returns empty: assert each stub only saw its own entries and that the wrapper's returned list has oneMultiTableAggregatedCommitInfocontaining onlytable1. That covers the retry-list pathSinkAggregatedCommitterTask.restoreStatedepends on. - Severity: Low
Issue 6: New test covers one table with an all-success return; the multi-table split and the positional retry-list merge on the restore path are not exercised
- Location:
seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitterTest.java:106 - Why it matters: - The added test registers a single
table1committer whoserestoreCommit(MultiTableSinkAggregatedCommitterTest.java:88-91) returnsCollections.emptyList(), so the only thing asserted is the dispatch choice atMultiTableSinkAggregatedCommitter.java:104. - The behaviour this PR introduces for real jobs is per-table routing of restore across multiple tables and merging each table's returned retry list into
errorListby position (MultiTableSinkAggregatedCommitter.java:110-115), whichSinkAggregatedCommitterTask.restoreStateturns intoCheckpointException(AGGREGATE_COMMIT_ERROR)when non-empty. Neither the split nor the merge is exercised on the restore path. - Fix: add a two-table case in which one
restoreCommitreturns a non-empty retry list and assert - (a) each table committer received only its own infos and
- (b) the returned
MultiTableAggregatedCommitInfocarries the retry entry under the correct identifier. - Evidence:
seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitterTest.java:86 return Collections.emptyList();;seatunnel-api/src/test/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitterTest.java:106 info.put("table1", "xid-1"); - Suggested fix: This proves the dispatch to
restoreCommit, which is the core of the fix. SincecommitPerTableis now shared, it would be worth one more case with two tables where onerestoreCommitreturns a non-empty retry list, asserting (a) each table committer only sees its own infos and (b) the returnedMultiTableAggregatedCommitInfocarries the retry entry under the correct identifier — that is the pathSinkAggregatedCommitterTask.restoreStateturns intoAGGREGATE_COMMIT_ERROR. - Severity: Low
Issue 7: Explanatory // comment above an @Override and a raw List on the changed line; this package uses Javadoc for method contracts
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:78 - Why it matters: -
MultiTableSinkAggregatedCommitter.java:78-79explain why the override exists using a//line comment directly above@Override.SinkAggregatedCommitter(SinkAggregatedCommitter.java:41) andJdbcSinkAggregatedCommitter.restoreCommit(JdbcSinkAggregatedCommitter.java:86-95) document method contracts with Javadoc, and this rationale is exactly what the next reader ofrestoreCommitneeds to see in the IDE. MultiTableSinkAggregatedCommitter.java:102keeps the rawList errCommitListwhile assigning fromsinkCommitter.restoreCommit(commitInfo)/sinkCommitter.commit(commitInfo); onlysize()andget(i)are used afterwards (:106-114), soList<?>compiles against theSinkAggregatedCommitter<?, ?>return type and avoids widening raw-type usage.- Fix: convert the two-line comment into a Javadoc block on
restoreCommit, and declareList<?> errCommitList. - Evidence:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:79 // differently from commit; the inherited default would route it to commit instead.;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:102 List errCommitList =;seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:78 // Restore must reach each table's restoreCommit, which may treat already-resolved commits - Suggested fix: Nit: this rationale is useful — could it be a Javadoc block on
restoreCommitinstead of a//comment above@Override, matching howSinkAggregatedCommitterandJdbcSinkAggregatedCommitter.restoreCommitdocument their contracts? Also, on line 102List<?> errCommitListworks against theSinkAggregatedCommitter<?, ?>return type and avoids adding another rawList. - Severity: Low
Issue 8: Changed line keeps a raw List for the committer's return value; List<?> is sufficient and narrows the raw-type usage
- Location:
seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkAggregatedCommitter.java:102 - Why it matters: - Root cause:
MultiTableSinkAggregatedCommitter.java:102declaresList errCommitList = restore ? sinkCommitter.restoreCommit(commitInfo) : sinkCommitter.commit(commitInfo);with a rawList. - Impact: cosmetic; the raw
commitInfoargument at:93has to stay raw becauseSinkAggregatedCommitter<?, ?>cannot accept a typed list, but the return value only needssize()andget(i)(:106-114, whose result goes into aMap<String, Object>), whichList<?>provides without an unchecked warning. - Fix: change the declaration to
List<?> errCommitList = .... - Suggested fix: Nit: since you are touching this line anyway,
List<?> errCommitList = ...compiles fine here (onlysize()/get(i)are used below) and avoids extending the raw-type usage; the rawcommitInfoargument above genuinely needs to stay raw, this one does not. - Severity: Low
Review conclusion
Conclusion: final approval remains pending on the previous comments
2. Remaining follow-ups
- Issue 1: restoreCommit fails fast on the first table that throws; remaining tables' in-doubt XA transactions stay prepared and the propagated exception carries no table identifier
- Issue 2: Architecture doc still shows a stale
restoreCommitsignature and says nothing about the multi-table wrapper forwarding it; this PR is what makes the hook reachable under Zeta, so the doc should be corrected alongside it - Issue 3: User-visible restore behaviour changes for JDBC XA and Iceberg under Zeta, but there is no release/upgrade note; the existing JDBC XA entry in incompatible-changes.md describes behaviour that was not actually reachable before this PR
- Issue 4: This override also activates IcebergAggregatedCommitter.restoreCommit under Zeta for the first time; the PR only validated JDBC XA, and the existing Iceberg savepoint IT ran while that code was unreachable
- Issue 5: The new test exercises a single table whose
restoreCommitreturns an empty list; the per-table split and the retry-list merge on the restore path are not covered - Issue 6: New test covers one table with an all-success return; the multi-table split and the positional retry-list merge on the restore path are not exercised
- Issue 7: Explanatory
//comment above an@Overrideand a rawListon the changed line; this package uses Javadoc for method contracts - Issue 8: Changed line keeps a raw
Listfor the committer's return value;List<?>is sufficient and narrows the raw-type usage
Thanks for the updates so far. Happy to discuss the remaining points.
DanielLeens
left a comment
There was a problem hiding this comment.
Review conclusion
Reviewed commit: 73f6621
No source-level blocking issue found in the complete two-file scan. MultiTableSinkAggregatedCommitter.restoreCommit() now dispatches the per-table payload to SinkAggregatedCommitter.restoreCommit() rather than inheriting the interface default that delegates to commit(). The normal restore path reaches this override, while the ordinary commit path still selects commit(); the added test proves both dispatches.
Compatibility: no public signature or serialized payload changes.
Best change location: the aggregate committer is the correct boundary because it owns the table-to-committer fan-out. Moving this branch to each concrete committer would duplicate multi-table routing; the small shared helper keeps the two paths structurally aligned.
Validation performed: fetched the current PR ref; inspected the full diff, the implementation call path, and the new unit test. No local build/test was run because this review did not require compilation to establish the dispatch behavior.
CI gate: the current Build check is failing, so this is not yet ready to merge despite the source review. Please provide a green Build run.
Conclusion
Source review: no blocking finding. Final merge gate: wait for successful CI.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the contribution! This is a genuinely important fix, and the diagnosis behind it is exactly right — I traced it through the Zeta restore path and confirmed the problem is real on the affected path, not a theoretical one.
What this PR solves
When a job using a multi-table sink is restored from a checkpoint/savepoint, SinkAggregatedCommitterTask.restoreState calls aggregatedCommitter.restoreCommit(...). MultiTableSinkAggregatedCommitter did not override restoreCommit, so it fell through to SinkAggregatedCommitter's default (return commit(...)) — meaning every per-table committer received commit() on the restore path.
For connectors whose restoreCommit semantics genuinely differ from commit, this is not cosmetic:
JdbcSinkAggregatedCommitter.restoreCommit(seatunnel-connectors-v2/connector-jdbc/.../JdbcSinkAggregatedCommitter.java:97-107) runsreplayRecoveredCheckpoint(...)against freshly collected XA recovery evidence — i.e. it replays already-resolved in-doubt transactions instead of committing prepared ones.IcebergAggregatedCommitter.restoreCommit(seatunnel-connectors-v2/connector-iceberg/.../commit/IcebergAggregatedCommitter.java:64-76) explicitly checksfilesCommitter.isAlreadyCommitted(checkpointId, allResults)and skips a checkpoint that was already committed.
Routing restore through commit() therefore risks re-committing transactions/checkshots that were already resolved, which is exactly the class of problem the two-phase protocol exists to prevent.
How it runs
Job restore from checkpoint / savepoint
-> SinkCommitterTask / SinkAggregatedCommitterTask.restoreState(...) [SinkAggregatedCommitterTask.java:257-281]
-> aggregatedCommitter.restoreCommit(aggregatedCommitInfos) <-- restore path
-> MultiTableSinkAggregatedCommitter
BEFORE this PR: inherited default -> commit(...) -> per-table sinkCommitter.commit(...)
AFTER this PR: commitPerTable(infos, restore=true)
-> per-table sinkCommitter.restoreCommit(...) <-- each table gets its own restore semantics
Both overloads now share one private helper, so the routing logic cannot drift between the two paths again. abort is deliberately left untouched, which is correct — abort has no separate restore variant.
Review findings
I went through the whole diff and the call chain. No blocking issues.
Non-blocking notes, none of which I think warrant a re-roll:
MultiTableSinkAggregatedCommitter.java:80— the new private helper keeps the pre-existing rawList errCommitList/ rawcommitInfolocals. I know this is inherited from the originalcommitbody and not introduced here, so I am not asking for it in this PR; a follow-up cleanup could parameterize the helper properly if you ever want it.- The new comment above
restoreCommitexplains why the override exists, which is the important part. Good.
Tests
testRestoreCommitRoutesToTableRestoreCommit has real failure ability: with the override removed, the recorded calls would be commit[xid-1] twice instead of restoreCommit[xid-1], commit[xid-1], so the test genuinely guards the routing rather than just re-asserting the implementation. Asserting both restoreCommit then commit on the same row also pins the ordering, which is what makes the regression detectable. Test stability rating: stable — no timing waits, no shared state, no external resources.
Compatibility
Fully compatible. No API signature, config option, default value, or serialization format changes. Only the method dispatch on the restore path changes, and it changes toward the behaviour every per-table committer already implemented. Connector code needs no modification.
Conclusion: can be merged
From a source standpoint this is a precise, minimal fix at the right layer — the shared multi-table committer rather than any individual connector — with a test that would catch a regression. I'm happy to approve this one.
One note on CI: the Build check on this branch is currently red, but this branch is behind_by=25 versus dev and the last build ran on 2026-10-17. I can't read the external build log from here, and a 2-file seatunnel-api change that only adds a method override is very unlikely to be the cause. The lowest-cost next step is to sync with the latest dev and rerun the build; if it still fails, please paste the failing log here and I'll dig into it with you.
DanielLeens
left a comment
There was a problem hiding this comment.
Thank you @ricky2129 for the fix and for keeping the branch in sync. The only commit since my last review is a merge of dev (head 3c333b52ee, previous reviewed head 73f6621c27). Comparing the two heads, the PR's two files (MultiTableSinkAggregatedCommitter.java and its test) are untouched; the only overlapping dev change is in incompatible-changes.md (en/zh). I re-read the whole diff and the restore call chain on this head. I also owe you an apology: @SEZ9 posted a detailed review on the previous head (eight points) and my last round did not fold those in. I have checked each one against the code below, and I now agree with most of them as non-blocking follow-ups. I did not compile or run anything.
What Problem Does This PR Solve?
- User pain point: Under Zeta every sink runs inside
MultiTableSink, so on restoreSinkAggregatedCommitterTaskcallsMultiTableSinkAggregatedCommitter.restoreCommit. That class did not override it, so the interface default (return commit(...),SinkAggregatedCommitter.java:42-45) ran, and a connector's ownrestoreCommitwas never reached. For the JDBC XA sink (JdbcSinkAggregatedCommitter.restoreCommit, #11569) this means a restore re-commits XIDs that were usually already committed, MySQL answersXAER_NOTA, and the job cannot restore (#12805). - Fix approach: Override
restoreCommitand route it through a sharedcommitPerTable(infos, restore)helper that keeps the existing per-table split and error-list merge and only switches betweenrestoreCommitandcommit. - One-sentence summary: The multi-table wrapper now forwards the restore call to each table's own
restoreCommit.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path (restore under Zeta):
SinkAggregatedCommitterTask.restoreState() (SinkAggregatedCommitterTask.java:~260-281)
-> aggregatedCommitter.restoreCommit(deserialized infos) (:~275)
-> MultiTableSinkAggregatedCommitter.restoreCommit() (MultiTableSinkAggregatedCommitter.java:80-84) [new override]
-> commitPerTable(infos, true) (:86-119)
-> per sinkIdentifier: pick that table's entries (:93-101)
-> restore ? sinkCommitter.restoreCommit(...) : sinkCommitter.commit(...) (:102-105)
-> merge non-empty retry lists by position into errorList (:106-115)
-> non-empty result -> CheckpointException(AGGREGATE_COMMIT_ERROR)
- The normal restore path reaches the change: every sink goes through
MultiTableSinkon Zeta, andrestoreStateis the only production caller ofrestoreCommit(checked with a search of the non-test sources). The ordinary commit path still selectscommit()(:75), and the new test pins both dispatches in order. abortandcloseare correctly left alone; there is no restore variant of them.- Only two production connectors override
restoreCommit:JdbcSinkAggregatedCommitterandIcebergAggregatedCommitter. So the blast radius of this override is exactly those two, under Zeta. - The shared helper is the right level: the wrapper owns the table fan-out, and a per-connector workaround would duplicate that routing.
1.2 Compatibility Impact
API, config, serialization and state formats are unchanged, so it is fully compatible at the contract level. It does change restore behavior under Zeta for the two connectors above: JDBC XA restores stop failing with XAER_NOTA and start following the recovery-order rules already described in incompatible-changes.md (the "JDBC XA restore now uses recovery-order evidence and fail-closed gaps" entry), and Iceberg restores now skip checkpoints that isAlreadyCommitted reports instead of re-running commitFiles. Both are moves toward what those committers were written to do, but they are user-visible (Issues 3 and 4).
1.3 Performance / Side-Effect Analysis
No new per-record cost; the restore runs once per task start. For tables with no restored entries the call still receives an empty list, which is the same shape as the existing commit() path (JDBC restoreCommit only calls tryOpen() in that case, like the commit path).
1.4 Error Handling and Logging
Issue 1: Restore fails fast on the first table that throws, and the error does not name the table (raised by @SEZ9, I agree)
- Location:
MultiTableSinkAggregatedCommitter.java:102-105 - Problem: the loop over
aggCommitters.keySet()has no per-table handling, so the first exception from any table'srestoreCommit(for JDBC,tryOpen()failing or the fail-closed XID gap check) unwinds the loop and the later tables are not reconciled in that attempt. The surfaced exception carries nosinkIdentifier.abort()andclose()in the same class already catch per table, log, keep the first throwable and rethrow after the loop. - Potential risk: moderate rather than severe. The job fails and is retried from the same checkpoint, and both committers' restore paths are meant to be idempotent, so the skipped tables are reconciled on the next attempt. The cost is slower diagnosis and a restore that cannot make partial progress while one table keeps failing.
commit()has the same shape today, so this is not a regression. - Best improvement: apply the
abort()pattern at least to the restore branch: log withsinkIdentifier, remember the first throwable, continue, and rethrow at the end with the identifier in the message. - Severity: Medium (non-blocking; I would accept it as a follow-up)
- Raised by another reviewer: Yes (@SEZ9, Issue 1)
Issue 2: Architecture doc shows a stale restoreCommit signature (raised by @SEZ9, I agree)
- Location:
docs/en/architecture/api-design/sink-architecture.md(theSinkAggregatedCommittersnippet,default void restoreCommit(...) throws IOException {}) - Problem: the real method returns
List<AggregatedCommitInfoT>and defaults tocommit(...). A connector author following the doc would write avoidmethod that overrides nothing. Since this PR is what makes the hook reachable under Zeta, it is a natural place to fix it, and to add one sentence that the multi-table wrapper forwardsrestoreCommitper table. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issue 2)
Issue 3: No upgrade note for the user-visible restore change (raised by @SEZ9, I agree)
- Location:
docs/en/introduction/concepts/incompatible-changes.mdand the zh counterpart, under## dev - Problem: the JDBC XA restore semantics are already documented there as if they applied, but under Zeta they only take effect with this PR, and Iceberg restores start skipping already-committed checkpoints. The PR description mentions only JDBC.
- Best improvement: a short entry saying the multi-table wrapper now forwards
restoreCommit, naming JDBC XA and Iceberg, and mention Iceberg in the PR's user-facing-change section. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issue 3)
Issue 4: Iceberg's restoreCommit becomes reachable under Zeta for the first time (raised by @SEZ9, I agree)
- Location:
MultiTableSinkAggregatedCommitter.java:83;IcebergAggregatedCommitter.java:64-78 - Problem: the end-to-end validation covered only MySQL-CDC to JDBC XA. The Iceberg savepoint recovery IT is Zeta-only and its Javadoc says it exercises
restoreCommit, but until now that method could not run there. Theiceberg-connector-itjob is in this PR's CI matrix, so the answer will come from CI; please check it explicitly when it finishes rather than relying on the aggregate status. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issue 4)
Issue 5: The new test covers one table with an empty return; the split and the retry-list merge on the restore path are not exercised (raised by @SEZ9 twice, I agree)
- Location:
MultiTableSinkAggregatedCommitterTest.java:75-117(testRestoreCommitRoutesToTableRestoreCommit) - Problem: the test is a real regression guard for the routing bug (removing the override makes it record
commit[xid-1]twice, so it turns red). But because the filtering and positionalerrorListmerge now live in the shared helper, one more case would make the restore path safe to refactor: two tables where onerestoreCommitreturns a non-empty retry list, asserting each stub saw only its own entries and the returnedMultiTableAggregatedCommitInfoholds the retry entry under the right identifier. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issues 5 and 6)
Issue 6: Style nits (raised by @SEZ9, Issues 7 and 8)
- Location:
MultiTableSinkAggregatedCommitter.java:78-79and:102 - Problem: the rationale for the override is a
//comment above@Override; a Javadoc block would show up in the IDE and matches how the interface documents its contract. The rawList errCommitListis inherited from the oldcommit()body, andList<?>would work since onlysize()andget(i)are used. Neither needs to block the PR. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9)
2. Code Quality Assessment
2.1 Coding Standards
Small, focused diff; the extracted helper keeps the two paths structurally identical, so they cannot drift apart. No new classes, so no license header question. See Issue 6 for the comment form.
2.2 Test Coverage and Test Stability
testRestoreCommitRoutesToTableRestoreCommit asserts the exact ordered call list restoreCommit[xid-1], commit[xid-1], so removing the override, swapping the flag, or routing restore back to commit fails it; the author also reports it fails on dev with a clear message. It uses an in-memory stub with no timing or shared state. Stability rating: Stable. The gap is multi-table coverage (Issue 5). The cross-module risk (Iceberg and JDBC under Zeta) is covered only by connector ITs, which are running in CI (Issue 4).
2.3 Documentation Updates
Not updated yet: the architecture doc (Issue 2) and incompatible-changes.md en/zh (Issue 3).
3. Architectural Soundness
The fix sits at the right layer, the multi-table wrapper, and uses the existing interface hook rather than adding a new one. The only structural trade-off is that commit() and restoreCommit() now share a fail-fast loop (Issue 1); making that loop per-table resilient is the one improvement I would consider worth doing in this class.
4. Issue Summary
| Number | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | Fail-fast restore loop, error does not name the table | MultiTableSinkAggregatedCommitter.java:102-105 | Medium | Yes (@SEZ9) |
| 2 | Stale restoreCommit signature in architecture doc |
sink-architecture.md | Low | Yes (@SEZ9) |
| 3 | No incompatible-changes note for JDBC XA and Iceberg restore change | incompatible-changes.md (en/zh) | Low | Yes (@SEZ9) |
| 4 | Iceberg restoreCommit newly reachable under Zeta, check the Iceberg IT |
MultiTableSinkAggregatedCommitter.java:83 | Low | Yes (@SEZ9) |
| 5 | Test covers one table with an empty return | MultiTableSinkAggregatedCommitterTest.java:75-117 | Low | Yes (@SEZ9) |
| 6 | Comment form and raw List |
MultiTableSinkAggregatedCommitter.java:78-79, 102 | Low | Yes (@SEZ9) |
5. Merge Recommendation
CI for head 3c333b52ee (fork run 39551627031, still running when I looked; apache Build is pending): unit-test is red on all four lanes with LLMBooleanOutputTest.readsLegacyFactoryWrapperWithValidationDisabled in seatunnel-transforms-v2 (InvalidClassException ... AbstractMultiCatalogTransform; local class incompatible). This PR changes only seatunnel-api sink code and a test, and the same failure appears on other open PRs that are 0 commits behind dev, so it is not caused by this diff. My reading of the logs is that a hard-coded legacy stream in a test merged with #12194 no longer matches the serialVersionUID after #12804; I did not find a fix PR. The branch is 0 commits behind dev and mergeable.
Conclusion: Ready to merge after fixes
Blockers
- CI must be green on the final head; the red
unit-testjob needs a fix ondevfirst, then rerun only the failed jobs. Please also confirmiceberg-connector-itand the JDBC ITs pass. I see no source-side blocker.
Recommended fixes (non-blocking)
- Issue 1: per-table error handling with the table name in the message, at least for restore.
- Issues 2 and 3: correct the architecture doc snippet and add a short
incompatible-changes.mdentry (en/zh). - Issue 5: one two-table test case.
- Issue 6: Javadoc instead of the
//comment,List<?>for the retry list.
Overall assessment: a precise, minimal fix at the right layer for a real restore failure on Zeta, with a regression test that can fail. A committer approval is still needed; I am not approving until CI is green.
|
A CI-status correction on unchanged head Concrete inspected log evidence (one representative JDK/OS per failed family; this does not claim every matrix leg has the identical cause):
Upstream/next-step check: The archived LLM fixture is tracked in #12929; proposed fix #12938 remains open. Latest The missing Maven wrapper class is a bootstrap failure, not an executed connector assertion. No matching base-branch wrapper correction was identified. A targeted retry of that failed job after download/bootstrap availability recovers is the useful diagnostic; do not add product dependencies to compensate. My previous source-level conclusion remains unchanged: no outstanding source blocker from my side. This is a CI-status follow-up, not a fresh full code review or formal approval. The branch is ahead 6, behind 9, compare |
|
Thanks for your patience. The upstream status has changed since my preceding note: #12938 merged into The archived-wrapper Other failed job families in the same head's run are |
DanielLeens
left a comment
There was a problem hiding this comment.
Thank you @ricky2129 for the focused fix. I re-reviewed the latest head d9e1a8a06722 in full. Compared with my previous round (3c333b52ee) the two PR files are byte-for-byte unchanged (the new head is another dev merge), so every point from my last review is a carryover. I again traced the full restore chain through the engine and the SupportMultiTableSinkWriter/committer contract; I found no new source-level blocker. I did not run builds or tests; the notes below are from reading source and CI results.
What Problem Does This PR Solve?
- User pain point: Under Zeta every sink is wrapped in
MultiTableSink, so on restore the engine callsMultiTableSinkAggregatedCommitter.restoreCommit. The class did not override it, so the interface default (SinkAggregatedCommitter.java:42-45,return commit(...)) ran and a connector's ownrestoreCommitwas never reached. For the JDBC XA sink the restore re-commits XIDs that were already committed, MySQL answersXAER_NOTA, and the job cannot restore (#12805). - Fix approach: Override
restoreCommitin the wrapper and route it through a sharedcommitPerTable(infos, restore)helper that keeps the per-table split and error-list merge and only switches betweenrestoreCommitandcommit. - One-sentence summary: The multi-table wrapper now forwards restore to each table's own
restoreCommitinstead of silently downgrading it tocommit.
1. Code Change Review
1.1 Core Logic Analysis
Changed: MultiTableSinkAggregatedCommitter.java (commit() now delegates to commitPerTable(infos, false), new restoreCommit() delegates to commitPerTable(infos, true)) and one new unit test.
// before: restoreCommit not overridden -> interface default -> commit()
List errCommitList = sinkCommitter.commit(commitInfo);
// after
List errCommitList = restore ? sinkCommitter.restoreCommit(commitInfo) : sinkCommitter.commit(commitInfo);Runtime path on restore:
SinkAggregatedCommitterTask.restoreState() SinkAggregatedCommitterTask.java:260-281
-> aggregatedCommitter.restoreCommit(deserialized infos) :275
-> MultiTableSinkAggregatedCommitter.restoreCommit() [new]
-> commitPerTable(infos, true)
-> per sinkIdentifier: pick that table's entries from MultiTableAggregatedCommitInfo
-> table committer.restoreCommit(entries) (JdbcSinkAggregatedCommitter.java:97, IcebergAggregatedCommitter.java:64-78)
-> merge non-empty retry lists by position into errorList
-> non-empty result -> CheckpointException(AGGREGATE_COMMIT_ERROR) :276-278
Findings: the normal Zeta restore path hits this change (restoreState is the only production caller of restoreCommit). The normal commit path is unchanged and still calls commit(). The table split uses the same sink identifier keys that combine() produced, so restored state deserialized from a checkpoint maps to the same table committers. Only two production connectors override restoreCommit (JDBC and Iceberg), so the blast radius is exactly those two under Zeta. The helper is the right level; a per-connector workaround would duplicate the fan-out. Logic is correct.
1.2 Compatibility Impact
Partially incompatible (behavioral, not contract). Serialization, state formats, config and APIs are unchanged, and connectors without a restoreCommit override behave exactly as before. But restore behavior under Zeta changes for JDBC XA (follows the recovery-order and fail-closed-gap rules already documented) and for Iceberg (restores now skip checkpoints reported by isAlreadyCommitted instead of re-running commitFiles). Both are moves toward what those committers were written to do, but they are user-visible and are not yet recorded in the upgrade notes (Issue 3).
1.3 Performance / Side-Effect Analysis
No per-record cost; restore runs once per committer task start. For tables with no restored entries the call still receives an empty list, the same shape as the existing commit() path. No new threads, buffers, or retained state.
1.4 Error Handling and Logging
Issue 1: Restore fails fast on the first failing table and the error does not name the table (carryover from my last round)
- Location:
MultiTableSinkAggregatedCommitter.javacommitPerTableloop (therestoreCommitdispatch line) - Problem description: no per-table handling, so the first exception (for JDBC,
tryOpen()failing or the fail-closed XID gap check) unwinds the loop; later tables are not reconciled in that attempt and the surfaced exception lacks thesinkIdentifier.abort()andclose()in the same class already catch per table, log, keep the first throwable and rethrow after the loop. - Potential risk: the job fails and retries from the same checkpoint, and both restore paths are meant to be idempotent, so this is slower diagnosis rather than data loss.
commit()has the same shape today, so it is not a regression. - Best improvement: apply the
abort()pattern at least to the restore branch: log withsinkIdentifier, remember the first throwable, continue, rethrow at the end with the identifier in the message. - Severity: Medium (non-blocking, acceptable as a follow-up)
- Raised by another reviewer: Yes (@SEZ9, Issue 1)
Issue 2: Architecture doc shows a stale restoreCommit signature
- Location:
docs/en/architecture/api-design/sink-architecture.md(SinkAggregatedCommittersnippet) - Problem description: the doc shows a
voidmethod with an empty default; the real method returnsList<AggregatedCommitInfoT>and defaults tocommit(...). - Potential risk: a connector author following the doc writes a
voidmethod that overrides nothing. - Best improvement: fix the snippet and add one sentence that the multi-table wrapper forwards
restoreCommitper table. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issue 2)
Issue 3: No upgrade note for the user-visible restore change
- Location:
docs/en/introduction/concepts/incompatible-changes.mdand the zh counterpart, under## dev - Problem description: JDBC XA restore semantics are documented as if already in effect, but under Zeta they only take effect with this PR; Iceberg restores also start skipping committed checkpoints. The PR description mentions only JDBC.
- Potential risk: upgrading users are surprised by changed restore behavior.
- Best improvement: add a short en/zh entry naming JDBC XA and Iceberg; mention Iceberg in the PR's user-facing-change section.
- Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issue 3)
Issue 4: Iceberg restoreCommit becomes reachable under Zeta for the first time
- Location:
MultiTableSinkAggregatedCommitter.javarestoreCommitoverride;IcebergAggregatedCommitter.java:64-78 - Problem description: the end-to-end validation covered only MySQL-CDC to JDBC XA.
IcebergSinkParallelCommitIT.testRecoveryFromSavepointProducesNoDuplicateSnapshotsis Zeta-only and says it exercisesrestoreCommit, which could not run there before. - Potential risk: an untested behavior change for a second connector.
- Best improvement: confirm the Iceberg connector IT passes on the final head and mention Iceberg in the description.
- Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issue 4)
Issue 5: The new test covers one table with an empty return
- Location:
MultiTableSinkAggregatedCommitterTest.java:75-117 - Problem description: the per-table split and the positional retry-list merge on the restore path are not exercised.
- Potential risk: a later refactor of the shared helper could break restore-path merging unnoticed.
- Best improvement: add a two-table case where one
restoreCommitreturns a non-empty retry list; assert each stub saw only its own entries and the returned info holds the retry entry under the right identifier. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issues 5 and 6)
Issue 6: Comment form and raw List
- Location:
MultiTableSinkAggregatedCommitter.javathe//comment aboverestoreCommitand the rawList errCommitList - Problem description: the rationale is a
//comment above@Override; the interface documents its contract with Javadoc. The raw list is inherited from the old body;List<?>would do. - Potential risk: none functionally; readability only.
- Best improvement: use a Javadoc block and
List<?>. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, Issues 7 and 8)
2. Code Quality
2.1 Coding Standards
Small, focused diff; the shared helper keeps the two paths structurally identical so they cannot drift. The new nontrivial helper commitPerTable has no Javadoc explaining the restore flag; this is covered under Issue 6 (Low).
2.2 Test Coverage and Test Stability
Rating: Stable. testRestoreCommitRoutesToTableRestoreCommit asserts the exact ordered calls restoreCommit[xid-1], commit[xid-1], so removing the override or routing restore back to commit turns it red. It is in-memory with no timing. Gap: multi-table coverage (Issue 5). CI status on the current head is not green (see section 5), so I cannot claim the Iceberg and JDBC ITs have validated the cross-module effect.
2.3 Documentation
Not updated: architecture doc (Issue 2) and incompatible-changes.md en/zh (Issue 3).
3. Architectural Soundness
- 3.1 Precise fix, at the right layer (the wrapper), using the existing interface hook.
- 3.2 Maintainability: good; one shared helper. The shared fail-fast loop (Issue 1) is the one thing worth hardening.
- 3.3 Extensibility: any future connector overriding
restoreCommitis automatically honored under Zeta. - 3.4 Historical-version compatibility: no change to serialized commit info or checkpoint formats, so states written by older versions restore through the same keys; only the invoked method changes for JDBC XA and Iceberg.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Fail-fast restore loop, error does not name the table | MultiTableSinkAggregatedCommitter.java commitPerTable | Medium |
| 2 | Stale restoreCommit signature in architecture doc |
sink-architecture.md | Low |
| 3 | No incompatible-changes note (JDBC XA, Iceberg) | incompatible-changes.md (en/zh) | Low |
| 4 | Iceberg restoreCommit newly reachable under Zeta |
MultiTableSinkAggregatedCommitter.java; IcebergAggregatedCommitter.java:64-78 | Low |
| 5 | Test covers one table with an empty return | MultiTableSinkAggregatedCommitterTest.java:75-117 | Low |
| 6 | Comment form and raw List |
MultiTableSinkAggregatedCommitter.java | Low |
5. Merge Recommendation
CI on head d9e1a8a06722: the apache-side Build check is failing. In the fork run (Build 40347152059) the Run / all-connectors-it-3 (11, ubuntu-latest) leg failed after about 2.5h with "SeaTunnel job executed failed" annotations, while the 17 leg of the same job passed, and several downstream jobs were skipped or cancelled. I could not retrieve the full failure log, so I cannot attribute the failing test; the diff touches only seatunnel-api sink code and a unit test, so a relation is not evident, but I am not asserting it is unrelated either. Please rerun only the failed job and check its log.
Conclusion: Ready to merge after fixes
Blockers
- CI must be green on the final head (rerun the failed
all-connectors-it-3 (11)job and confirm the skipped or cancelled stages, including the Iceberg and JDBC ITs, complete). I see no source-side blocker.
Non-blocking fixes
- Issue 1: per-table error handling with the table name, at least for restore.
- Issues 2 and 3: correct the architecture doc snippet and add the en/zh
incompatible-changes.mdentry. - Issue 5: one two-table test case.
- Issue 6: Javadoc and
List<?>. - Issue 4: mention Iceberg in the PR description.
Overall assessment: a small, correct, well-placed fix with a real regression test; the remaining items are hardening and documentation. Alternatives: a per-connector workaround in the JDBC committer would not help other connectors and duplicates the fan-out; the wrapper override is the better choice. Thanks again for the contribution.
|
Re-checked Should be addressed before merge
Nice to have / can be a follow-up if you prefer, but please say so
If you'd rather defer 3–6, just note that in a reply and I'll track them separately; 1 and 2 I'd like in this PR. Thanks for the focused fix. |
|
@ricky2129 please rerun failed job? |
DanielLeens
left a comment
There was a problem hiding this comment.
Thank you @ricky2129 for the focused fix. I re-reviewed the latest head c3437e23a797 in full. Compared with the previous round on d9e1a8a06722, the PR's own files are unchanged (git diff d9e1a8a06722..c3437e23a797 -- seatunnel-api is empty; the new head is another dev merge), so none of the earlier points were addressed yet and every issue below is a carryover from my last review. This is a refresh of the same conclusion, not new findings. I read source and CI results only; I did not build or run tests.
What Problem Does This PR Solve?
- User pain point: Under Zeta every sink is wrapped in
MultiTableSink, so on restore the engine callsMultiTableSinkAggregatedCommitter.restoreCommit. The class did not override it, so the interface default (SinkAggregatedCommitter.java:42, which callscommit(...)) ran and a connector's ownrestoreCommitwas never reached. For the JDBC XA sink this re-commits XIDs that were already committed, the database answersXAER_NOTA, and the job cannot restore (#12805). - Fix approach: Override
restoreCommitin the wrapper and route it through a sharedcommitPerTable(infos, restore)helper that keeps the per-table split and retry-list merge and only switches betweenrestoreCommitandcommit. - One-sentence summary: The multi-table wrapper now forwards restore to each table's own
restoreCommitinstead of silently downgrading it tocommit. - Example: A job with tables
t1andt2on the JDBC XA sink is restored from a checkpoint; previouslyt1/t2XIDs went throughcommit, now they go throughJdbcSinkAggregatedCommitter.restoreCommitwith its recovery-order handling.
1. Code Change Review
1.1 Core Logic Analysis
Changed: MultiTableSinkAggregatedCommitter.java (commit() delegates to commitPerTable(infos, false), new restoreCommit() delegates to commitPerTable(infos, true), dispatch at lines 102-105) and one new unit test.
// before: restoreCommit not overridden -> interface default -> commit()
List errCommitList = sinkCommitter.commit(commitInfo);
// after
List errCommitList = restore ? sinkCommitter.restoreCommit(commitInfo) : sinkCommitter.commit(commitInfo);Runtime path on restore:
SinkAggregatedCommitterTask.restoreState() (SinkAggregatedCommitterTask.java:275)
-> aggregatedCommitter.restoreCommit(deserialized infos)
-> MultiTableSinkAggregatedCommitter.restoreCommit() [new, lines 80-84]
-> commitPerTable(infos, true) [lines 86-119]
-> per sinkIdentifier: select that table's entries
-> table committer.restoreCommit(entries) (JdbcSinkAggregatedCommitter.java:97, IcebergAggregatedCommitter.java:64)
-> merge non-empty retry lists by position into errorList
-> non-empty result -> checkpoint exception
Findings: the normal Zeta restore path reaches this change (restoreState is the only production caller of restoreCommit). The normal commit path still calls commit() and is behaviorally unchanged. Table keys are the same sinkIdentifier strings that combine() produced, so restored state maps to the same table committers. Only JDBC and Iceberg override restoreCommit in production, so the behavior change is limited to those two under Zeta. The fix is at the right layer. Logic is correct.
1.2 Compatibility Impact
Partially incompatible (behavioral, not contract). Serialization, state format, config and public API signatures are unchanged, and connectors without a restoreCommit override behave exactly as before. Restore behavior under Zeta does change for JDBC XA (it now follows the documented recovery-order and fail-closed-gap rules) and for Iceberg (it now uses its own restore logic instead of re-running the commit). Both move toward what those committers were written to do, but they are user-visible and are not recorded in the upgrade notes (Issue 3).
1.3 Performance / Side Effects
No per-record cost; restore runs once at committer task start. No new threads, buffers or retained state. Tables with no restored entries still receive an empty list, the same shape as the existing commit() path.
1.4 Error Handling and Logging
Issue 1: Restore fails fast on the first failing table and the error does not name the table
- Location:
MultiTableSinkAggregatedCommitter.java:102-105(inside thecommitPerTableloop) - Problem: the first exception from a table's
restoreCommitunwinds the loop, so later tables are not reconciled in that attempt and the surfaced exception lacks thesinkIdentifier.abort()andclose()in this class already catch per table, log, keep the first throwable and rethrow after the loop. - Risk: the job fails and retries from the same checkpoint (restore paths are meant to be idempotent), so this costs diagnosis time rather than data.
commit()has the same shape today, so it is not a regression of this PR. - Best improvement: at least for the restore branch, catch, log with
sinkIdentifier, and rethrow with the identifier in the message (continuing over the remaining tables and rethrowing the first throwable afterwards, asabort()does, is the stronger option). - Severity: Medium (non-blocking, acceptable as a follow-up if agreed)
- Raised by another reviewer: Yes (@SEZ9, item 1)
2. Code Quality
2.1 Standards
Issue 5: Comment form and raw List
- Location:
MultiTableSinkAggregatedCommitter.java:78-79and line 102 - Problem: the explanation of why
restoreCommitis overridden is a//comment, and the newcommitPerTablehelper has no Javadoc describing therestoreflag. The changed line keeps a rawList. - Best improvement: use Javadoc on both methods, and
List<?>on the changed line. - Severity: Low
- Raised by another reviewer: Yes (@SEZ9, item 6)
2.2 Tests and Stability
Issue 4: The new test covers one table with an empty retry list
- Location:
MultiTableSinkAggregatedCommitterTest.java(testRestoreCommitRoutesToTableRestoreCommit) - Problem: it proves the override routes to
restoreCommit(removing the override or therestorebranch turns it red), but the per-table split and positional retry-list merge on the restore path are not exercised. - Best improvement: add one case with two or more tables where at least one
restoreCommitreturns a non-empty list, asserting the merged output positions and that each table sees only its own entries. - Severity: Medium (this is a seatunnel-api class with a state-recovery role, so I would like the merge covered)
- Raised by another reviewer: Yes (@SEZ9, item 5)
Stability rating: Stable (in-memory, deterministic, no sleeps, ports or shared resources).
2.3 Docs
Issue 2: Architecture doc shows a stale restoreCommit signature
- Location:
docs/en/architecture/api-design/sink-architecture.md:531 - Problem: it shows
default void restoreCommit(...) {}, while the real method returnsList<AggregatedCommitInfoT>and defaults tocommit(...). The doc says nothing about the multi-table wrapper forwarding it. - Risk: a connector author following the doc writes a
voidmethod that overrides nothing. - Best improvement: fix the snippet (en, and mention in zh
sink-architecture.md:201if it states the semantics) and add one sentence that the multi-table wrapper forwardsrestoreCommitper table. - Severity: Medium
- Raised by another reviewer: Yes (@SEZ9, item 2)
Issue 3: No upgrade note for the user-visible restore change
- Location:
docs/en/introduction/concepts/incompatible-changes.md(existing JDBC XA entry around line 316) and the zh counterpart - Problem: restore behavior for JDBC XA and Iceberg under Zeta changes with this PR, and the existing JDBC XA entry describes behavior that was not reachable through the multi-table wrapper before.
- Best improvement: add a short note, or state in the PR that it is deferred.
- Severity: Low
- Raised by another reviewer: Yes (@SEZ9, item 3)
Issue 6: Iceberg restore path is activated under Zeta for the first time and only JDBC XA was validated
- Location: PR description /
IcebergAggregatedCommitter.java:64 - Best improvement: run the existing Iceberg savepoint IT against this branch (or cite the CI result) and mention Iceberg in the PR description.
- Severity: Low
- Raised by another reviewer: Yes (@SEZ9, item 4)
3. Architecture
- 3.1 Precise fix: it corrects the actual root cause (the missing override in the generic wrapper) rather than patching individual connectors.
- 3.2 Maintainability: good; one shared helper keeps the commit and restore paths structurally identical.
- 3.3 Extensibility: the
booleanflag is acceptable for two paths; no need to generalize. - 3.4 Contract: the
SupportMultiTableSinkWriter/committer contract is untouched; no new registration is needed.
4. Issue Summary
| # | Issue | Location | Severity | Blocking |
|---|---|---|---|---|
| 1 | Fail-fast restore loop, error lacks table id | MultiTableSinkAggregatedCommitter.java:102-105 | Medium | No |
| 2 | Stale restoreCommit signature in architecture doc |
docs/en/architecture/api-design/sink-architecture.md:531 | Medium | Yes |
| 3 | No upgrade note | docs/en/introduction/concepts/incompatible-changes.md | Low | No |
| 4 | Test lacks multi-table / non-empty retry coverage | MultiTableSinkAggregatedCommitterTest.java | Medium | Yes |
| 5 | Javadoc and List<?> |
MultiTableSinkAggregatedCommitter.java:78,102 | Low | No |
| 6 | Iceberg restore not validated | PR description | Low | No |
CI: the head's Build check concluded timed_out. In the contributor fork run, 83 jobs succeeded, 11 were skipped and 2 were cancelled (transform-v2-it-part-2 (17, ubuntu-latest) and all-connectors-it-3 (11, ubuntu-latest)); the run was cancelled at the time limit rather than failing an assertion. This diff only touches seatunnel-api sink classes and a unit test, so these cancellations are not related to it. Please re-run the two cancelled jobs from the fork's Actions tab. The branch is 3 commits behind dev and mergeable is true, with no conflicts.
5. Merge Recommendation
Conclusion: Ready to merge after fixes
The source change is correct and minimal, and I found no source-level defect in it. Existing review state: there is no maintainer approval or change request recorded yet, so merge readiness still depends on a write-capable maintainer review plus green CI.
Blockers (before merge):
- Issue 2: correct the architecture doc signature and mention the wrapper's forwarding.
- Issue 4: add a two-table test with a non-empty retry list on the restore path.
- CI: re-run the two cancelled jobs until the
Buildcheck is green.
Non-blocking recommendations:
- Issue 1: name the failing table in the restore error (and ideally keep reconciling the remaining tables).
- Issue 3, Issue 5, Issue 6, as described above; if you would rather defer them, a one-line reply is enough and they can be tracked separately.
Thanks again for the clear root-cause analysis; this is close.
nzw921rx
left a comment
There was a problem hiding this comment.
+1 LGTM
https://github.com/ricky2129/seatunnel/actions/runs/40507160077/job/122200579062
CI has been cancelled due to timeout, PR has been fixed accurately. I have conducted complete local verification and will proceed with bypass
|
Thanks for the focused fix. I checked the restore call chain and ran local regression tests on PR head The forwarding change is correct: normal commits still call each table's Unit tests and build checks
All 588 tests listed above completed without failures, errors, or skips. The eight supplemental wrapper tests covered:
These supplemental tests were run locally; they have not been added to this PR. Real MySQL recovery testsThe tests used MySQL 8.0.43 and actual MySQL-CDC → JDBC jobs. Two Master instances and one Worker instance were started in one JVM and communicated over loopback networking. This validates actual connector and engine execution, but is not a multi-process or multi-host deployment test. The successful job scenarios included initial snapshots, streaming inserts/updates/deletes, checkpoint cancellation and restore, and two further savepoint/restore cycles. Source and target rows were compared after recovery and subsequent DML. Transactional target audit triggers also checked that successful XA restores did not replay writes. For the negative controls, the dev wrapper implementation was substituted into the same runtime while keeping the remaining components unchanged.
For JDBC with Real Iceberg recovery testsI also exercised the production
Nine Iceberg checks passed. This was a separate local connector recovery test, rather than a run of the existing Iceberg savepoint IT. Separate, pre-existing JDBC XA cleanup issueThe multi-table XA job failures above are important to distinguish from this PR's forwarding fix. After restoration, a table writer can prepare a valid new transaction before another table writer first opens. The latter calls I reproduced this independently with real prepared MySQL XA branches on both dev and the PR:
In the complete PR job, the logs first showed the restored checkpoint's already-resolved XIDs being skipped correctly. The later failure involved a new transaction and occurred through normal As a diagnostic control only, narrowing cleanup ownership in an isolated local copy preserved both prepared branches and allowed the same three-table job to complete all three restores and subsequent DML, ending with 96 matching rows and 204 audit records. This experimental change is not part of the PR, is not presented as a complete production fix, and its successful run is not counted as a successful run of the unmodified PR. This existing JDBC issue should be tracked separately. It does not invalidate the wrapper forwarding fix, but the results should not be described as closing every multi-table XA recovery scenario. An additional abrupt-Master-termination probe in the embedded setup timed out and remains inconclusive; it is not counted among the passing tests or attributed to this PR. I support the focused forwarding change. The local tests confirm the intended dispatch, unchanged default behavior, and the JDBC/Iceberg recovery improvement. |
|
Thanks @nzw921rx for the thorough local verification on A few items before this merges, mapped to the earlier review points: Tests (F5 / F6) – The eight supplemental wrapper tests you describe (per-table routing, unequal non-empty retry lists with table identifiers preserved, default Fail-fast on restore (F1) – "Exceptions remaining visible, with the existing fail-fast behavior" confirms the current behaviour but doesn't resolve the concern: when one table throws, the remaining tables are never restored and the propagated exception carries no table identifier. I'm fine with either (a) wrapping the exception with the table identifier in this PR, or (b) explicitly deferring it to a follow-up. Please say which. Iceberg (F4) – 131 Iceberg unit tests passing is good, but the real recovery runs described are MySQL-CDC → JDBC only. This PR makes Docs (F2 / F3) – Not mentioned yet: the stale Style (F7 / F8) – Minor: move the CI – Run Also, the negative-controls table in your comment appears cut off after the header row — could you repost the dev-control vs. PR results? |
Purpose of this pull request
Fixes #12805
Under Zeta every sink runs inside
MultiTableSink, so on restoreSinkAggregatedCommitterTaskcallsMultiTableSinkAggregatedCommitter.restoreCommit. It did not override it, and the interface default callscommit(), which calls each table'scommit(). So a sink's ownrestoreCommitwas never reached.For the JDBC XA sink,
JdbcSinkAggregatedCommitter.restoreCommit(#11569) skips transactions that are no longer prepared. Without it, a restore re-commits the checkpoint's XIDs, which were usually already committed before the failure: MySQL answersXAER_NOTA, the commit failure propagates, and the job cannot restore.This PR overrides
restoreCommitinMultiTableSinkAggregatedCommitterand routes it to each table'srestoreCommit, using the same per-table split ascommit().Does this PR introduce any user-facing change?
Yes. Restoring a job whose sink has its own
restoreCommitnow uses it. For the JDBC sink withis_exactly_once = true, restores no longer fail withXAER_NOTA. Sinks that don't overriderestoreCommitare unaffected: the default still callscommit().How was this patch tested?
MultiTableSinkAggregatedCommitterTest#testRestoreCommitRoutesToTableRestoreCommit. It fails on dev (expected: <restoreCommit[xid-1]> but was: <commit[xid-1]>) and passes with this change.-r. Before: every restore failed withXAER_NOTA. After: three restores in a row succeeded, already-committed batches were skipped, and the target matched the source.Check list
New License Guide