ricky2129 opened a new pull request, #12807:
URL: https://github.com/apache/seatunnel/pull/12807

   ### Purpose of this pull request
   
   Fixes #12805
   
   Under Zeta every sink runs inside `MultiTableSink`, so on restore 
`SinkAggregatedCommitterTask` calls 
`MultiTableSinkAggregatedCommitter.restoreCommit`. It did not override it, and 
the interface default calls `commit()`, which calls each table's `commit()`. So 
a sink's own `restoreCommit` was 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 answers `XAER_NOTA`, the commit failure propagates, and the 
job cannot restore.
   
   This PR overrides `restoreCommit` in `MultiTableSinkAggregatedCommitter` and 
routes it to each table's `restoreCommit`, using the same per-table split as 
`commit()`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Restoring a job whose sink has its own `restoreCommit` now uses it. For 
the JDBC sink with `is_exactly_once = true`, restores no longer fail with 
`XAER_NOTA`. Sinks that don't override `restoreCommit` are unaffected: the 
default still calls `commit()`.
   
   ### How was this patch tested?
   
   - Added 
`MultiTableSinkAggregatedCommitterTest#testRestoreCommitRoutesToTableRestoreCommit`.
 It fails on dev (`expected: <restoreCommit[xid-1]> but was: <commit[xid-1]>`) 
and passes with this change.
   - End to end, on a 2.3.12-based build with #11569 and #10459 backported: 
MySQL-CDC → JDBC with XA, the job failed by a target trigger and then restored 
with `-r`. Before: every restore failed with `XAER_NOTA`. After: three restores 
in a row succeeded, already-committed batches were skipped, and the target 
matched the source.
   
   ### Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add License 
Notice according
     [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the 
following files are updated:
     1. Update 
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
 and add new connector information in it
     2. Update the pom file of 
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in 
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in 
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
     5. Update connector 
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to