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

   Yes, I am contributing to Apache SeaTunnel. This change only adds end-to-end 
coverage to the Zeta engine E2E suite; no production code is modified.
   
   ### Purpose of this pull request
   
   Adds `RejectStrategyCapacityBlockedJobIT`, the first end-to-end test in this 
module for `job-schedule-strategy = REJECT`. It submits a job while another job 
owns the whole fixed-slot pool and pins the lifecycle the rejection path has to 
keep:
   
   1. The client completion future resolves `FAILED` within seconds and carries 
the `NoEnoughResourceException` that explains the resource shortfall, instead 
of leaving the client blocked on a job the scheduler will never run.
   2. The rejected job leaves the pending queue, its job master is released, it 
keeps reporting `FAILED` after that release (a lost terminal state here 
historically degrades to `UNKNOWABLE`), and it never owns a slot.
   3. The running job that legitimately holds the pool stays `RUNNING` and 
untouched, and the rejected job writes no checkpoint data.
   4. When the holder is cancelled and the exact capacity the rejected job had 
been waiting for becomes free, the rejected job is never revived and never 
re-enters the queue. This is the behavioural difference from `WAIT`, which 
keeps the job queued and dispatches it at that moment.
   5. The pending-job scheduler is still usable afterwards: a fresh replacement 
job with the same footprint reaches `RUNNING`.
   
   The fixture is the existing `pending_jobs_streaming.conf` (one streaming job 
occupies four fixed slots); the cluster is a single in-JVM Zeta node with 
`dynamic-slot: false`, `slot-num: 4` and `job-schedule-strategy: REJECT`, so 
the second submission is deterministically capacity blocked. Slot ownership is 
asserted through the resource manager and the owned-slot IMap, not only through 
the job status.
   
   ### Why this boundary has real regression risk
   
   The rejection path (`CoordinatorService#pendingJobSchedule` -> 
`CoordinatorService#completeFailJob`) runs on the single pending-job scheduler 
thread and blocks it on the rejected job's completion future. A regression 
there is therefore not local to the rejected job: job scheduling for the whole 
cluster can stall, or the job registry can be left with a queued entry, a 
leaked slot claim, or a status that no longer resolves. It is also the only 
path that ends a job before `JobMaster#run()` is entered, i.e. before task 
deployment, checkpoint scheduling, slot ownership and the normal terminal 
cleanup of a running job exist.
   
   Two tempting simplifications break it: keeping a `REJECT` job queued "just 
in case" capacity returns (it must not be revived, and must not block the 
queue), and completing only the job-end future without persisting the terminal 
state (the client then sees `FAILED` once and `UNKNOWABLE` afterwards).
   
   ### Why existing coverage does not reach it
   
   - `SeaTunnelSlotIT#testSlotNotEnough` and 
`#testSlotReleasedAfterNotEnoughResourceFailure` run a single undersized batch 
submission under the default strategy and only assert the terminal status / 
that a following job can run; they never reject a job because *another running 
job holds the pool*, and never check the "capacity appears later" boundary.
   - Every other scheduling E2E in this module explicitly switches to `WAIT` 
(`SplitClusterPendingJobLifecycleFailoverIT`, `SplitClusterFaultToleranceIT`, 
`PendingJobsRestIT`).
   - No E2E in this module configures `REJECT` at all.
   - Checkpoint-ID counter cleanup for jobs that end before scheduling is a 
separate concern (tracked separately) and is deliberately not asserted here.
   
   ### Does this PR introduce any user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   ```
   ./mvnw -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base 
verify \
     -DskipIT=false -DskipUT=true -DfailIfNoTests=false \
     -Dit.test=RejectStrategyCapacityBlockedJobIT
   ```
   
   Result: `Tests run: 1, Failures: 0, Errors: 0` on four consecutive runs on 
`dev` (`ee0fb0d72f`), about 9.5 seconds each. `spotless:apply` was run before 
the runs.
   
   Negative control: treating the `REJECT` branch as `WAIT` in 
`CoordinatorService#pendingJobSchedule` (the "silently keep it queued" 
regression above) makes the test fail: the rejected job never completes, so the 
bounded wait for its completion future expires with a `TimeoutException` after 
120 seconds. The engine change was reverted and is not part of this PR.
   
   ### 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/developer/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new 
feature.
   * [ ] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR.
   * [x] The change is test-only and does not touch connector code.
   


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