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

   Yes — contributing this change to Apache SeaTunnel.
   
   ## What this adds
   
   A new engine E2E guard, `CancelDuringDeploymentIT`, for cancelling a Zeta 
job while one of its task groups is still being deployed: the pipeline already 
owns its fixed slices and the worker already published the task group's 
execution context, but the task's sink writer has not been created yet, so the 
task has not reported `READY_START` and no row has been produced. Cancelling 
exactly there has no E2E coverage today.
   
   ## Contract pinned
   
   1. A cancel accepted inside that deployment window must resolve the job to 
`CANCELED` within a bounded time instead of wedging it in `CANCELING`. The 
parked deployment is held longer than the cancel bound, so the job can only 
pass if the cancel neither waits for the deployment nor depends on it finishing.
   2. The job must not be created again / the deployment must not be 
duplicated: exactly one writer-creation attempt for the cancelled job and no 
row may reach the sink.
   3. The task group must stop being actively deployed on the worker, and every 
fixed slice must return to the worker pool.
   4. The terminal `CANCELED` state must stay resolvable after the `JobMaster` 
is released.
   5. Releasing the abandoned restore function afterwards must not revive the 
job, rebuild its `JobMaster`, re-acquire slices or redeploy the task group (8s 
continuous window).
   6. The freed capacity must accept a new job with the same footprint: it 
reaches `RUNNING`, streams rows through the sink, owns the slices, then cancels 
and returns the whole pool.
   
   ## Why existing coverage does not reach it
   
   - `JobClientJobProxyIT#testNoExceptionLogWhenCancelJob` cancels only after 
the job is `RUNNING`.
   - 
`SplitClusterFaultToleranceIT#testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck`
 covers a lost cancel acknowledgement when the worker disappears, not a cancel 
that lands on a deployed-but-not-started task.
   - The savepoint/restore and pending-job cancel scenarios cancel work that is 
either already running or has not been deployed at all.
   
   ## Determinism
   
   `DeploymentHoldSinkWriter` parks its own construction — the engine creates 
the writer from the action restore function before `READY_START` — and reports 
that exact call to the test through a latch, so the test waits on the 
deployment instead of guessing sleeps. The sink is a plain fixture: it counts 
rows and holds the writer creation; no connector, transform or SQL semantics 
are involved and no production code is changed.
   
   ## Negative controls
   
   Both mutations were applied to a scratch build of `seatunnel-engine-server` 
and reverted afterwards:
   
   - Removing the task-future interrupts from 
`TaskGroupExecutionTracker#cancelAllTask`: the test still passes — cancellation 
is cooperative through the task-group completion signal, which is the intended 
design.
   - Dropping the `exception(e)` completion signal from the cancellation 
callback so the task group can never report itself completed: the test fails 
after the 60s bound with `The cancelled job did not reach a terminal state 
within 60 seconds`, i.e. the guard detects a job whose cancel cannot retire its 
deployment.
   
   ## Verification
   
   ```
   ./mvnw -o -q -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
     -DskipUT=true -DskipIT=false -Dit.test=CancelDuringDeploymentIT 
-DfailIfNoTests=false verify
   ```
   
   Five consecutive passing runs, 13.7s–14.9s each (clean `dev` engine build).
   
   ```
   ./mvnw -o -q -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base spotless:check  
 # exit 0
   ./mvnw -o -q -pl seatunnel-ci-tools -Dtest=ImportClassCheckTest 
-DfailIfNoTests=false test        # exit 0
   git diff --check                                                             
                     # exit 0
   ```
   
   ## Notes
   
   - Test-only change: no production code, no public API, no configuration 
option and no default value changes, so there is no backward-compatibility 
impact.
   - No GitHub issue: the engine behaved correctly in this window, so there is 
no defect to report with this round; the PR adds the missing regression guard 
only.
   


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