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

   Yes, this is a contribution to Apache SeaTunnel.
   
   ## What this adds
   
   One engine-level end-to-end regression test for the `FAILED` terminal path 
of a Zeta job: when a job exhausts its `job.retry.times` budget, the whole 
fixed-slot pool it held must be allocatable again, the terminal state must stay 
stable, and the checkpoint data needed for a later restore must be kept.
   
   New files (test-only, no engine change):
   
   - `PermanentFailureCapacityReleaseIT` — the contract test.
   - `permanent-failure/stream_fake_to_armable_failing_sink.conf` — job fixture 
(`job.retry.times = 2`).
   - `failurecapacity/ArmableFailingSink*` — test-only sink whose writer fails 
on demand and counts deployments.
   
   ## Contract pinned by the test
   
   On a single in-process hybrid node with `dynamic-slot = false`, `slot-num = 
4`, `job-schedule-strategy = WAIT` and a streaming job (`checkpoint.interval = 
1000`, `job.retry.times = 2`, `job.retry.interval.seconds = 1`):
   
   1. The pipeline first reaches `RUNNING` and completes a real checkpoint.
   2. Once the test arms the failing sink, the pipeline fails, is restored 
exactly twice and the job ends `FAILED` — i.e. exactly three deployments, no 
more, no less.
   3. `FAILED` is terminal: after a window much longer than the retry interval 
the status is still `FAILED`, no fourth deployment happens and the terminal 
state is still queryable through the client after the coordinator released the 
job.
   4. The fixed-slot pool returns byte-for-byte to its pre-job snapshot: all 
four slices are free again, the assigned-slice count and the unassigned heap 
are back to the baseline, and no slot-ownership record for the job survives in 
`engine_ownedSlotProfilesIMap`.
   5. The failed job keeps its checkpoint data selectable for 
`RestoreMode.CHECKPOINT` (the engine only purges checkpoints on 
`FINISHED`/`CANCELED`), which is what makes an operator-driven recovery 
possible.
   6. A replacement job with the same footprint is placed immediately, reaches 
`RUNNING`, and its cancellation hands the pool back to the same baseline.
   
   ## Why this boundary has real regression risk
   
   `FAILED` is reached through the restore machinery, not through a plain 
cancel: every attempt releases the job's slots and re-applies them for the next 
attempt. A single mistake in that bookkeeping either leaks fixed-slot capacity 
(the cluster silently shrinks and later jobs stay `PENDING`) or drops the 
retained checkpoint (a permanently failed job can no longer be recovered). The 
retry budget itself is part of the contract as well: one attempt too few 
abandons a recoverable job, one too many turns a deterministic failure into an 
endless retry loop. All of these properties are only observable on a real 
cluster with a real fixed-slot pool, real task deployments and real checkpoint 
files.
   
   ## Why existing coverage does not reach it
   
   - `JobClientJobProxyIT#testJobRetryTimes` only asserts retry log lines of a 
containerised cluster; it never looks at the eventual terminal state or the 
slot pool.
   - `SplitClusterTerminalZombieJobMasterSwitchIT` produces a `FAILED` job with 
`job.retry.times = 0` and asserts checkpoint retention across a master switch, 
not capacity accounting or the retry budget.
   - `SeaTunnelSlotIT` and #13508 (fixed-slot capacity accounting) only drive 
jobs through the `CANCELED` and `FINISHED` paths.
   - No existing test drives a job through several real restore attempts and 
then checks that the pool is back to its pre-job state.
   
   ## Verification
   
   - Pristine `origin/dev` @ `5cf050be3f`: 4 consecutive green runs (24.6s, 
24.5s, 22.5s, 24.6s) of
     `./mvnw -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base -DskipUT=true 
-DskipIT=false -Dit.test=PermanentFailureCapacityReleaseIT verify`,
     the last one with `spotless.check` enabled.
   - Negative control: with `DefaultSlotService#releaseSlot` no longer 
returning a fixed slice to the free pool, the test fails in 9.4s with
     `job.retry.times=2 must allow exactly two restores, i.e. three deployments 
==> expected: <3> but was: <2>` — a retry cannot even re-acquire the released 
capacity. Reverted; the reinstalled `seatunnel-engine-server` jar matches the 
pristine checksum 
`97dd3e224d0e08a6317132c93e274fcbc61db56ea59c3fdb5ab150bec06dd312` and the 
final run is green.
   - `./mvnw spotless:apply` applied.
   


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