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

   Yes — this change contributes to **Apache SeaTunnel** (Zeta engine E2E 
coverage).
   
   ### Motivation
   
   In `dynamic-slot: true` mode (the engine default), a worker does not hand 
out slices of a
   pre-partitioned fixed pool: it creates a slot for every task group a job 
asks for, records the job
   as its owner, and discards each created slot when the job ends. `slot-num` 
is irrelevant in that
   mode, and a released dynamic slot is *not* returned to the fixed pool, so 
the worker's
   `assignedSlots` map is the only record of what is still in use.
   
   That lifecycle is the resource contract every default-mode Zeta deployment 
depends on, and a
   regression in it is silent: the job itself still completes, but the worker 
keeps advertising
   assigned slots whose task contexts are gone. On a long-lived worker the leak 
accumulates with every
   job, so the advertised resource view (and any capacity-based scheduling 
built on it) drifts away
   from reality.
   
   ### Change
   
   Test-only addition under 
`seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base`:
   
   - `DynamicSlotLifecycleIT` runs two consecutive batch jobs on a single 
hybrid node explicitly
     configured with `dynamic-slot: true` and `slot-num: 1`, while a 
parallelism-3 `FakeSource`
     pipeline gives the job three chained reader/writer task groups plus the 
split enumerator:
     - each job must run with exactly four dynamically created slots even 
though the fixed slot count
       is one (the job is RUNNING, never PENDING or rejected);
     - while it runs, all four slots must be owned by that job in both the 
worker profile and the
       distributed slot-ownership map;
     - when it finishes, every slot must be released (`assignedSlots` back to 
empty), the worker must
       not recycle released dynamic slots into the fixed pool, no ownership 
record may remain, and the
       job master must be released;
     - the second job must receive its own fresh slots, disjoint from the first 
job's, and release
       them the same way, so slots cannot accumulate across job boundaries.
   - `DynamicSlotHoldSink` + `DynamicSlotHoldSinkFactory` are a passive fixture 
(`@AutoService`) whose
     writers park on their first row until the test releases them, so the slot 
observations are taken
     while every task group is deployed and running instead of racing a short 
batch job; the bounded
     source then drains (27 rows per job, asserted once each) and the job 
finishes.
   
   ### Existing coverage gap
   
   - `DynamicSlotNoCapacityCheckIT` documents that a single dynamic-slot job is 
granted a slot for
     every task group without a capacity rejection; it never checks what 
happens to those slots after
     the job ends and never runs a second job.
   - `SeaTunnelSlotIT`, `SplitClusterPendingJobLifecycleFailoverIT`, the 
`allocatestrategy` ITs and
     every slot-release test added for fixed-slot capacity pin `dynamic-slot: 
false`.
   - No existing engine E2E asserts the release, ownership cleanup or cross-job 
non-accumulation of
     dynamically created slots.
   
   I searched open and closed PRs for the same objective (`dynamic slot 
release`, `dynamic slot
   lifecycle`, `slot accumulation`) before writing the test; the only related 
open PR changes the
   default slot mode (#11500), which this test does not depend on because it 
selects the mode
   explicitly.
   
   ### Modules and compatibility
   
   New test-tree files only. No production code, public API, SPI, configuration 
option, default value,
   state or file format changes. No new dependencies; the fixture sink is not 
visible outside the test
   classpath.
   
   ### Verification
   
   ```bash
   export JAVA_HOME=<jdk17>
   mvn -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base 
spotless:apply
   mvn -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
       verify -DskipUT=true -DskipIT=false -Dit.test=DynamicSlotLifecycleIT 
-DfailIfNoTests=false
     Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   mvn -pl seatunnel-ci-tools test -Dtest=ImportClassCheckTest
     Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   Seven consecutive green targeted runs on `dev` `1e7e29a75b` with the 
pristine `engine-server` jar
   (sha256 `e3687ea6c3c4ebc9caffa94e8ad57c5d7dc5df90dcfa93ed219d91ce1339137a`), 
13.1 s–13.5 s each;
   `spotless:check` is bound to `validate` and passed in every run. Observed 
evidence from a green run:
   
   ```
   Job 1179638795838947329 owns dynamic slots [1, 2, 3, 4]      (worker 
slot-num = 1)
   Job 1179638795839012865 owns dynamic slots [5, 6, 7, 8]      (fresh slots, 
no reuse/accumulation)
   ```
   
   Negative control: making `DefaultSlotService#releaseSlot` keep released 
dynamic slots in
   `assignedSlots` (the leak this IT must catch) fails the new test in 127 s 
with
   `unexpected number of assigned dynamic slots: [1, 2, 3, 4] ==> expected: <0> 
but was: <4>`; the
   mutation was reverted, the pristine engine jar reinstalled (sha256 above) 
and the green runs
   repeated. `git diff --check` is clean.
   
   No engine defect was found, so no issue is filed.
   


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