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

   ### Purpose of this pull request
   
   Yes — thank you for contributing to Apache SeaTunnel. This PR adds one 
test-only Zeta engine E2E; no production/business logic is modified.
   
   **Contract guarded.** A client force-stop (`JobClient#cancelJob(jobId, 
true)` → `CancelJobOperation` with `force=true` → `CoordinatorService#stopJob`) 
exists so an operator can end a job whose tasks do not answer the graceful 
`CANCELING` handshake. On a single in-process node with a fixed two-slot pool 
(`dynamic-slot=false`, `slot-num=2`, WAIT scheduling), a RUNNING streaming job 
whose sink writer deliberately swallows interrupts and stays parked in 
`write()` must therefore:
   
   1. resolve the force-stop RPC and the client completion future with 
`CANCELED` inside a bounded window while the task is still provably parked (the 
writer is released only after the assertions);
   2. reach the terminal `CANCELED` state instead of staying in `CANCELING` or 
degrading to `UNKNOWABLE` after the coordinator releases the job master;
   3. return every fixed slot it owned to the worker — asserted both through 
`engine_ownedSlotProfilesIMap` and functionally by a second job that needs the 
whole pool reaching `RUNNING`;
   4. stay `CANCELED` after the parked writer is finally released.
   
   **Why this is not already covered.**
   
   - `ClusterSeaTunnelEngineContainer#testForceStopJob` / `#testForceStopJobV2` 
only force-stop a healthy, cooperative job through the REST API and then assert 
it shows up under finished `CANCELED` jobs. The graceful cancel path that this 
fixture defeats satisfies those assertions unchanged, and they assert no 
resource release.
   - `CoordinatorServiceTest#testForceStopAbnormalSavepointJob` (the unit test 
shipped with the force-stop feature, #10075) hand-builds a `CoordinatorService` 
and never runs a real task that refuses cancellation.
   - The merged stop-path E2E 
`SplitClusterPendingJobLifecycleFailoverIT#testSavepointStopReleasesFixedSlotsSoQueuedJobRuns`
 covers stop-with-savepoint slot release with a cooperative task, a different 
cancel mode.
   - No existing test pins the property that makes force-stop meaningful: it 
must not wait for the task-level cancel acknowledgement.
   
   **Implementation.** A test-only sink (`ForceCancelBlockingSink`, registered 
through `@AutoService(TableSinkFactory.class)` as `ForceCancelBlockingTest`) 
parks the chained source+sink task group inside `write()` after the test arms 
it, and counts the interrupts it deliberately swallows. The IT drives the real 
client protocol against a real in-process node, then proves slot release with a 
capacity-probe job (FakeSource → Console, same whole-pool footprint).
   
   **Regression it catches.** If `PhysicalVertex#forceStop` or the `stopJob` 
branch starts waiting for the task terminal callback (for example by dropping 
the direct `CANCELED` transition and relying on `cancel()`), the test fails at 
the terminal-state assertion because the parked writer can never ack. If the 
force path stops returning the pipeline's fixed slots, the capacity probe stays 
`PENDING` and the test fails there.
   
   No GitHub issue is filed: the engine behaviour is correct on current `dev`; 
this PR only pins it.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only change.
   
   ### How was this patch tested?
   
   ```bash
   mvn -o -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base 
verify \
     -DskipUT=true -DskipIT=false -Dit.test=ForceCancelUnresponsiveTaskIT 
-DfailIfNoTests=false
   ```
   
   - Green six consecutive times on `origin/dev` @ `5cf050be3f` with the final 
version of the assertions: 8.847s, 8.685s, 8.359s, 8.201s, 8.799s, 8.418s. 
`spotless:check` ran (not skipped) in the final run and passed.
   - Negative control: downgrading the force branch in 
`CancelJobOperation#doRun` to the cooperative `cancelJob(jobId)` path makes the 
test fail after 63.6s with `expected: <CANCELED> but was: <CANCELING>` at the 
terminal-state assertion, proving the test actually guards the force semantics 
rather than passing through the graceful path. The production code was reverted 
and the pristine `seatunnel-engine-server` jar reinstalled (`sha256 
97dd3e224d0e08a6317132c93e274fcbc61db56ea59c3fdb5ab150bec06dd312`), then the 
green runs were repeated.
   - `git diff --stat` against `dev` contains only the five new test files (IT, 
sink, factory, two confs); no engine source is touched.
   


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