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

   Yes, I'd like to contribute this coverage to Apache SeaTunnel.
   
   ## What this PR adds
   
   A test-only Zeta engine E2E: `SaturatedSlotPoolRestoreIT`. It guards the 
in-place pipeline restore
   path when the job already owns the **entire** fixed-slot pool of the 
cluster. No production code is
   changed (E2E only).
   
   ## The contract
   
   A parallel-1 streaming pipeline needs exactly two fixed slots (the 
split-enumerator task group plus
   the chained source/sink task group). The test runs such a pipeline on a 
worker whose `slot-num` is
   2, so the job's own allocation saturates the pool (`assignedSlots == 2`, 
zero unassigned heap, zero
   unassigned slots). After several completed checkpoints the test-only sink 
throws exactly once from
   `write()`.
   
   The contract asserted end to end:
   
   1. the job is `RUNNING` and provably owns every slot of the pool before the 
failure;
   2. the job-level status never leaves `RUNNING` while the pipeline fails and 
is restored;
   3. the pipeline is restored **in place, exactly once** (`pipelineRestoreNum 
== 1`), and the restored
      writer is opened with a non-empty checkpoint state that was snapshotted 
before the failure
      (observed: 8192 restored rows while 8230 rows had been written at failure 
time), so it really
      resumed from a checkpoint instead of being redeployed from scratch;
   4. the restored pipeline re-acquires both slots, keeps consuming rows, and 
the worker never reports
      more assigned slots than the pool has;
   5. cancelling the job releases every slot, leaving the whole pool and its 
heap unassigned again.
   
   ## Why this is a boundary with real regression risk
   
   In fixed-slot mode a slot is not a soft claim: once all slots are handed out 
the worker refuses every
   further request. `SubPlan#stateProcess` therefore has to return the failing 
pipeline's allocation to
   the pool **before** re-applying for it; otherwise the restore request is 
rejected by the very pool
   the job is still holding and the job burns its `job.retry.times` budget on 
allocation failures
   instead of on the real failure. Slot release ordering in the restore path is 
easy to break silently:
   the job stays `RUNNING`, no data assertion changes, and the only symptom is 
that the restored task
   never starts. The negative control below is exactly that failure.
   
   ## Why the existing coverage does not reach it
   
   - `SeaTunnelSlotIT` asserts rejection/release around a failed submission, 
never a pipeline restore.
   - `SplitClusterFaultToleranceIT` restores after a node loss, where the whole 
worker's slots are gone
     and the master re-applies on a different member; release ordering inside 
one pipeline is not
     exercised.
   - The in-place restore tests in this package 
(`ClusterFaultToleranceTwoPipelineIT` and the sibling
     tests) run with the module's default dynamic-slot configuration, where a 
request is never rejected
     for lack of capacity, so they pass even if the failing pipeline's slots 
were never handed back.
     They also concentrate on the finished/failed sibling rather than on 
rescheduling the failed
     pipeline itself.
   - `SeaTunnelSlotIT#testSlotReleasedAfterNotEnoughResourceFailure` covers the 
release of a failed
     submission, not the release-then-reacquire of an in-place restore.
   
   ## Fixture
   
   - `SaturatedSlotPoolRestoreIT` — in-JVM master + worker, `dynamic-slot: 
false`, `slot-num: 2`,
     `ScheduleStrategy.WAIT`.
   - `stream_fake_to_probe_sink.conf` — one STREAMING `FakeSource -> probe 
sink` pipeline,
     `parallelism = 1`, `checkpoint.interval = 500`, `job.retry.times = 3`.
   - Test-only sink under `saturatedslotrestore/`: no committer (so the slot 
arithmetic is fixed), a
     `Long` row counter as writer state with an explicit `Serializer` (without 
it the engine silently
     creates a fresh writer instead of restoring state), 1 ms/row backpressure, 
and a static probe
     registry that records writer opens, checkpoint snapshots and the injected 
failure.
   
   ## Evidence
   
   - Final fixture green on `origin/dev` `1e7e29a75b`: 24.585 s and 24.664 s; 
the same fixture family
     was green five more times (24.7 s – 24.8 s) after the writer-state 
serializer was added, with
     `spotless:check` included in every run.
   - Negative control: removing `jobMaster.releasePipelineResource(this)` from 
the `FAILED/CANCELED`
     restore branch of `SubPlan#stateProcess` makes the test fail after 141.8 s 
with
     `The failed pipeline must be restored in place; writer opens so far: [0]` 
— the restore could
     never acquire slots. Mutation reverted, pristine engine-server jar 
reinstalled
     (sha256 
`e3687ea6c3c4ebc9caffa94e8ad57c5d7dc5df90dcfa93ed219d91ce1339137a`), green runs 
repeated.
   - `ImportClassCheckTest` exit 0, `git diff --check` exit 0.
   
   ## Scope
   
   Test-only; no production code changes. No issue is filed because the 
contract already holds on
   `dev` and the negative control shows the test fails when 
release-before-restore is broken.
   


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