SEPURI-SAI-KRISHNA commented on issue #13469:
URL: https://github.com/apache/seatunnel/issues/13469#issuecomment-7224139731

   Thanks @DanielLeens. Revised, fail-closed proposal, read on dev `ee0fb0d72f`.
   
   **1. Scope, opt-in.** New `RestorableSinkCommitter<T> extends 
SinkCommitter<T>` with `void restoreCommit(List<T>)`: returns only if the info 
is committed now or was before, else throws. First PR: Kafka and Doris only. 
All other committers get no new state and restore as today; Flink and Spark 
never call it.
   
   **2. State.** For such a sink the plan registers one more key, 
`ActionStateKey - <sink> - commit info`, at the sink's parallelism. At barrier 
N it holds the `prepareCommit(N)` info, serialized with the sink's 
`getCommitInfoSerializer()` (empty without `EXACTLY_ONCE` or 2PC). It is part 
of checkpoint N, so its checkpoint id is the restored one. Existing entries are 
unchanged; an old checkpoint lacks the key and restores as today; old code 
restores only its plan's keys.
   
   **3. Restore and abort.** `SinkFlowLifeCycle.restoreState` calls 
`restoreCommit` before creating the writer, as 
`SinkAggregatedCommitterTask.restoreState` does. A throw fails that restore 
attempt; after `job.retry.times` the job is FAILED with the connector's error. 
The restored info is never aborted. The writers leave N alone (Kafka aborts 
`<prefix>-(N+1)` on, Doris label `_(N+1)` on).
   - Kafka: open txn committed; committed txn, broker returns NONE (to be 
proven). Aborted by `transaction.timeout.ms` (client default 60 s) or expired 
id: fail.
   - Doris: pre-committed txn committed, then VISIBLE awaited; "already 
COMMITTED/VISIBLE" accepted; aborted or unknown: fail.
   - Pulsar, not opted in: `TransactionNotFound` follows both commit and 
timeout abort.
   - SelectDB Cloud, not opted in: a second `COPY INTO` of the same files is 
unverified, and `abort` is a no-op.
   For these two the loss stays; I will open a follow-up for each.
   
   **4. Proof in the PR.** Zeta, test sink whose info lists its rows: commit of 
checkpoint 1 throws once; worker stopped after checkpoint 1 completed, before 
its commit. Both assert every row committed exactly once. Plus: a throwing 
`restoreCommit` ends FAILED; other committers and old checkpoints restore as 
today. Kafka and Doris E2E: the same info committed twice lands once 
(`read_committed` for Kafka); after an abort, the commit fails.
   
   One choice: with `-r` from a savepoint older than 
`transactional.id.expiration.ms` (7 days), the Kafka replay always fails. 
Replay only on Zeta's own restores (pipeline restore, master switch) and keep 
`-r` as today, or on every restore?
   


-- 
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