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

   ### Contribution acknowledgement
   
   Yes — I am contributing this change to **Apache SeaTunnel**, and I confirm 
it follows the project's contribution conventions (English PR 
title/description, one focused change, formatting and E2E validated locally). 
This is a test-only change: no production code, configuration default, REST/API 
or data format is modified.
   
   ### What this PR does
   
   Adds `MultiPipelineSlotAdmissionIT`, an E2E regression guard for the atomic 
slot admission of a **multi-pipeline job** on the Zeta engine, plus a test-only 
sink fixture that records whether a pipeline was ever deployed.
   
   The fixture is a single in-JVM Zeta node with five fixed slots 
(`dynamic-slot: false`, `slot-num: 5`, `ScheduleStrategy.WAIT`):
   
   - the **holder** is a parallel-1 streaming job that owns two slots and stays 
`RUNNING`;
   - the **target** is a streaming job with two independent parallel-1 
`FakeSource` pipelines, so it needs four slots. Its sink is a test-tree probe 
that records writer opens and rows written per pipeline label.
   
   The test requires that:
   
   - while the holder runs, the target can satisfy only one pipeline and part 
of its sibling, so it must stay `PENDING` for several three-second 
pending-scheduler cycles, remain the only entry of the pending queue, and 
**neither probe writer may ever be opened**;
   - the partially granted slots must return to the fixed-slot pool on every 
retry cycle. The test samples the worker's advertised unassigned heap for the 
whole pending window and requires it to reach the two-slot level at least once 
(a window maximum, so it does not depend on where in the retry cycle it looks);
   - cancelling the holder must admit the target **with all four slots at 
once**, both pipelines must write rows, and the job must stay `RUNNING` over a 
stability window;
   - cancelling the admitted job must restore the baseline exactly: no assigned 
slot, all five slots free, the whole max heap advertised as unassigned, no slot 
ownership and no job master left behind.
   
   ### Why this is a boundary with real regression risk
   
   The all-or-nothing admission is implemented by 
`JobMaster#preApplyResources`, which joins every task group's future across 
**all** pipelines of the job and releases the successful ones when the last 
future fails. It is easy to refactor that loop into per-pipeline admission 
(which would start a half-resourced job), into a partial release (which would 
leak capacity on every three-second `WAIT` retry), or into an admission check 
that only looks at the first pipeline. None of these failures is visible from 
the job's own terminal state: they either run a job that should have waited or 
make a later healthy job `PENDING` forever, with every job still reporting a 
valid status.
   
   ### Why the existing coverage does not reach it
   
   - `SeaTunnelSlotIT` covers a single-pipeline job whose task groups exceed 
the pool, and `testSlotReleasedAfterNotEnoughResourceFailure` only observes the 
pool after a failed submission.
   - `WaitStrategyQueuedJobHandoffIT` (PR #13707) covers single-pipeline 
waiters releasing a partial grant during queue handoff; it has no sibling 
pipeline that could start while the job is not admitted.
   - `SplitClusterPendingJobLifecycleFailoverIT` drives pending jobs through 
master changes, capacity growth and head-of-line blocking, not through a 
partially satisfiable multi-pipeline job.
   - `ClusterFaultToleranceTwoPipelineIT` exercises multi-pipeline jobs only 
through worker/master failure, where the whole job is restored together.
   
   No existing engine E2E asserts that a pipeline of a multi-pipeline job stays 
undeployed while a sibling pipeline cannot be resourced, nor that the job is 
admitted as a whole when capacity is released.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Test-only change: one E2E class, one test-tree sink fixture and two test 
resource files.
   
   ### How was this patch tested?
   
   ```
   ./mvnw -pl seatunnel-engine/seatunnel-engine-server -am install -DskipTests
   ./mvnw -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
     -DskipUT=true -DskipIT=false -Dit.test=MultiPipelineSlotAdmissionIT \
     -DfailIfNoTests=false verify
   ./mvnw -pl seatunnel-ci-tools test -Dtest=ImportClassCheckTest
   ```
   
   Result: `Tests run: 1, Failures: 0, Errors: 0, Skipped: 0` (about 21 s on 
JDK 17), five targeted runs; the final run was a full `verify` including 
`spotless:check`. `ImportClassCheckTest` passes (8 tests). The run log shows 
the partial grant being exercised and released, e.g.:
   
   ```
   Pre resource application failed for job: 1179401100025987073, success: 3, 
failed: 1/4
   ```
   
   Negative control: skipping the release of the partially granted slots in 
`JobMaster#preApplyResources` makes the test fail in 13.2 s at the pool 
assertion ("the highest unassigned heap observed was 3 bytes (two slots are 
5153960754 bytes)"); the mutation was reverted, the pristine engine-server jar 
was reinstalled (sha256 `dd06e8ab…`), and the test passes again.
   


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