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

   Yes, I am contributing this change to Apache SeaTunnel. This PR only adds 
E2E coverage and one test fixture; it does not change engine, connector or 
configuration behaviour.
   
   ## Background
   
   When a member leaves, only the task groups hosted by that member fail 
immediately. The other task groups of the same pipeline are still deployed on 
the surviving members and still own their fixed slots, so the job can only 
become terminal after the master cancels those surviving task groups and 
releases their slots.
   
   For a job that cannot restore (`job.retry.times = 0`), that release is the 
*only* path that returns the surviving member's slots. It is also a different 
path from a local cancel or a stop-with-savepoint: in those flows every task 
group is closed through the normal stop flow, and each task group's own close 
completes its slot release. On member loss the failed member's slot bookkeeping 
is already gone with the member, so the master has to release a task group it 
never stopped.
   
   If that release is skipped, the slot is never returned to the resource 
manager. The failed job is already `FAILED`, so nothing looks broken; the 
damage only shows up as every job queued behind it being starved forever on a 
fixed-slot cluster.
   
   ## What this PR adds
   
   
`SplitClusterPendingJobLifecycleFailoverIT#testHolderFailureOnWorkerLossReleasesFixedSlotsSoQueuedJobRuns`,
 pinning the whole contract end to end:
   
   - Two workers with three fixed slots each 
(`SlotServiceConfig#setSlotNum(3)`, dynamic slot off) and 
`ScheduleStrategy.WAIT`.
   - The holder is the shared 
`cluster_batch_fake_to_localfile_no_restore_template.conf` fixture 
(`job.retry.times = 0`, ten paced splits), run with parallelism 2. A batch 
FakeSource -> transactional LocalFile pipeline owns one slot per task group 
(split enumerator + two reader/writer groups + aggregated committer), i.e. four 
of the six slots.
   - A short second batch job 
(`cluster_batch_fake_to_localfile_queued_after_failed_holder_template.conf`, 
three task groups) is submitted and must be parked as `PENDING` in the master's 
pending queue while owning no slot, because only two slots are free.
   - One worker is shut down. The holder must reach `FAILED`, and its entry 
must disappear from the master's fixed-slot ownership map 
(`Constant.IMAP_OWNED_SLOT_PROFILES`) — the surviving worker's slots are the 
assertion target.
   - Nothing else can free a slot at that point (the dead worker's slots are 
gone with the member, and the survivor's three slots were owned by the failed 
holder), so the queued job can only run if that release actually happened. It 
must be dispatched with no further trigger, leave the queue, finish `FINISHED`, 
and commit exactly its configured row count; the failed holder must stay 
`FAILED`.
   
   The class already had a `createBatchTestResources` helper, so it is 
generalized into `createTemplatedBatchTestResources(template, ...)` and the old 
helper now delegates to it; no behaviour change for its existing caller.
   
   ## Why existing coverage does not reach this
   
   - 
`ClusterFailureNoRestoreIT#testBatchJobWithoutCheckpointAndRetryConvergesAfterWorkerShutdown`
 tears a worker down under the same no-retry batch job, but never submits a 
second job, so it cannot observe whether the surviving worker's slot was 
returned.
   - 
`SplitClusterPendingJobLifecycleFailoverIT#testPendingJobScheduledAfterRunningJobCanceled`
 frees capacity by cancelling the holder (local stop flow).
   - 
`SplitClusterPendingJobLifecycleFailoverIT#testSavepointStopReleasesFixedSlotsSoQueuedJobRuns`
 frees it through the stop-with-savepoint path.
   - `SeaTunnelSlotIT#testSlotReleasedAfterNotEnoughResourceFailure` covers a 
release that happens before any task group was deployed.
   
   ## Verification
   
   - `./mvnw -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base -DskipUT 
-DskipIT=false 
-Dit.test='SplitClusterPendingJobLifecycleFailoverIT#testHolderFailureOnWorkerLossReleasesFixedSlotsSoQueuedJobRuns'
 verify` — passes, 1 test, 22.9 s, then 22.7 s on a repeat run (JDK 17, 
in-process master + two workers, no container needed).
   - `./mvnw -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base -DskipUT 
-DskipIT=false 
-Dit.test='SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover'
 verify` — still passes (69.6 s) after the helper refactor.
   - `./mvnw spotless:apply` on the touched module.
   
   No GitHub issue is filed because this PR adds coverage for behaviour that is 
currently correct; no production code is touched. Neighbouring coverage added 
in #13446 (savepoint stop) and #13487 (cancelled queued job).
   


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