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

   ### Contribution
   
   Yes — this change is contributed to Apache SeaTunnel.
   
   ### What this PR adds
   
   A test-only Zeta engine E2E, `CommitterStateRestoreIT`, that pins one 
checkpoint-restore contract of the master:
   
   > When a pipeline restores in place after a task failure, the **writer 
state** and the **aggregated-committer state** handed to the restored task 
groups must both come from the *same* completed checkpoint `X`, and `X` must be 
a checkpoint that had already completed before the failure — never the 
checkpoint that was in flight when the attempt died.
   
   The test observes both restore entry points directly 
(`SeaTunnelSink#restoreWriter` and `SinkAggregatedCommitter#restoreCommit`, 
implemented by a test-only sink) and asserts that:
   
   1. the writer is restored exactly once, from checkpoint `X`, with the row 
count that checkpoint snapshotted (`restoredRows == commitInfo(X).rows > 0`);
   2. the aggregated committer is handed the commit info of that same `X` by 
the post-failure restore;
   3. `X` was committed before the injected failure, so only a completed 
checkpoint can be a restore point;
   4. the job never leaves `RUNNING` through failure and restore, and 
`pipelineRestoreNum == 1`;
   5. the restored pipeline keeps consuming rows and commits a checkpoint above 
`X`;
   6. cancelling returns the whole fixed-slot pool to its pre-job state (no 
assigned slot, no ownership record, job master released).
   
   ### Why this boundary has real regression risk
   
   Writer state and aggregated-committer state travel through different task 
groups, different action-state keys and different restore entry points 
(`SinkFlowLifeCycle#restoreState` vs. 
`SinkAggregatedCommitterTask#restoreState`). If the master restores the writer 
from a newer checkpoint than the committer (or drops the committer state), the 
pipeline still reaches `RUNNING` and the mistake is silent: the restored 
attempt re-emits rows whose batch was already committed, or never commits the 
batch the restored writer will produce. That is an exactly-once violation 
instead of a visible failure, and it is only observable on a real cluster with 
real checkpoint files.
   
   ### Why the existing coverage misses it
   
   - `JobRestoreIT`, `SavepointRestoreIT`, `CheckpointRestoreWithStopIT` and 
`CheckpointRestoreRunningSourceIT` assert job-level outcomes (status, restore, 
data), not which checkpoint each restored component was handed.
   - `ClusterFaultToleranceTwoPipelineIT` and `SplitClusterFaultToleranceIT` 
assert pipeline restore counters and survivor behaviour after a member loss, 
not the restore point of the writer and the committer.
   - Connector E2E suites assert committed output, which passes even when the 
committer was restored without state, because the sinks used there commit 
idempotently.
   - `SinkAggregatedCommitterTaskCheckpointCacheLeakIT` covers the committer 
task's cache bookkeeping and `SinkAggregatedCommitterTaskTest` drives it with 
mocks; neither shows what a real pipeline restore delivers to a re-created 
committer.
   
   ### How the failure is produced deterministically
   
   The cluster runs inside the test JVM (single hybrid node, `dynamic-slot: 
false`, `slot-num: 4`, `job.retry.times: 3`). A STREAMING `FakeSource` feeds 
the test-only probe sink, which owns an aggregated committer and applies 1 ms 
of backpressure per row so the streaming source still has rows to replay after 
the restore. The probe writer fails exactly once from `write()`, but only after 
the committer has committed at least two checkpoints and the last commit 
carries rows, so the restore point has real writer state. All observations are 
records published by the code under test; the assertions wait on state changes 
instead of sleeping.
   
   The initial deployment also runs the stateless restore handshake of 
`SinkAggregatedCommitterTask`, so the test tells that invocation apart from the 
real one by timestamp relative to the injected failure.
   
   ### Scope
   
   Test-only: one probe sink, its factory, three serializable state classes, 
one observation-record holder and one job conf. No production code changes. The 
source and sink are simple fixtures; every assertion is about engine checkpoint 
restore, job lifecycle and slot accounting, never about transform, SQL or 
connector semantics.
   
   ### Validation
   
   - Green on `origin/dev` `1e7e29a75b` with four consecutive targeted runs: 
14.876 s, 14.047 s, 14.073 s and 13.946 s, plus a final run with 
`spotless:check` in `validate` (15.032 s).
   - Negative control: making `SinkAggregatedCommitterTask#restoreState` hand 
the committer an empty list fails the test in 10.4 s with `The in-place restore 
handed the aggregated committer no commit state`; the mutation was reverted and 
the suite re-ran green against the pristine engine.
   - `git diff --check` is clean.
   
   No engine defect was found in this area, so no issue is filed; this PR is a 
regression guard for an existing engine contract.
   


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