zhangshenghang opened a new pull request, #13508: URL: https://github.com/apache/seatunnel/pull/13508
Yes, I am contributing to Apache SeaTunnel. This change only adds regression coverage to the Zeta engine E2E suite; no production code is modified. ### What this PR does Adds `FixedSlotCapacityAccountingIT#testFixedSlotCapacityIsFullyRestoredAcrossJobLifecycles`, an end-to-end test for the byte-level accounting of the fixed-slot pool across job lifecycles. The test runs a real in-JVM master/worker Zeta cluster with `dynamic-slot=false`, `slot-num=4` and `schedule-strategy=WAIT`, drives three consecutive job lifecycles (streaming job -> `RUNNING` -> cancel, batch job -> `FINISHED`, streaming job again -> cancel), and requires: 1. Before any job, the worker advertises four free slots of exactly `maxHeap / 4` bytes each, no assigned slot, and its whole max heap as unassigned resource. 2. A job that owns the whole pool reports exactly four assigned slots and leaves only `maxHeap - 4 * (maxHeap / 4)` bytes (the integer-division remainder) unassigned, so the fixed pool is a hard byte-accounted ceiling rather than an estimate. 3. The persisted `engine_ownedSlotProfilesIMap` entries for that job carry exactly the four fixed slices, one per owned slot. 4. Cancelling the job restores the baseline exactly: all four slots free again, the whole max heap back as unassigned resource, no slot ownership left, and the job master released. 5. A job that finishes normally returns the pool the same way, so both terminal paths are covered. 6. Repeating the lifecycle does not drift: after a mixed cancel/finish/cancel sequence the pool is byte-for-byte back at the baseline and a fresh job still reaches `RUNNING` with all four slots. ### Why this boundary has real regression risk The accounting lives in three places that must stay symmetric: `DefaultSlotService#initFixedSlots` slices the heap, `requestSlot` subtracts the owned profile, and `releaseSlot` merges it back on every terminal path. Nothing verifies that the three agree. A double subtract or a skipped merge does not fail the job that caused it; it silently shrinks the inelastic fixed pool, and under the default `WAIT` strategy later jobs stay `PENDING` forever with no error reported anywhere. That is the capacity leak that is hardest to diagnose in production and the reason a byte-level, repeated-lifecycle assertion is worth pinning. ### Why the existing coverage does not reach it - `SeaTunnelSlotIT` only counts assigned/unassigned slots for a single job and its release; it never looks at the advertised heap. - `SplitClusterPendingJobLifecycleFailoverIT#testPendingJobScheduledAfterRunningJobCanceled` reuses the slots once after a cancel but does not assert resource bytes or the `FINISHED` release path. - `DynamicSlotNoCapacityCheckIT` is the dynamic-slot counterpart and deliberately asserts that the advertised heap does *not* move there, because every per-task profile is 0/0. - No existing test drives several fixed-slot lifecycles through both terminal paths and compares the advertised capacity with the exact baseline after each one. This test asserts the worker profile the scheduler consumes (`ResourceManager#getRegisterWorker`), not the REST/diagnostics projection discussed separately in #13354. ### Verification - `mvn -pl seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base failsafe:integration-test failsafe:verify -Dit.test=FixedSlotCapacityAccountingIT -DskipIT=false` on dev `ee0fb0d72f`: four consecutive green runs, 8.6s / 9.7s / 9.9s / 10.1s. - Negative control: skipping the `unassignedResource` merge in `DefaultSlotService#releaseSlot` makes the test fail at the first post-cancel assertion (`expected: <12884901888> but was: <0>`) after the one-minute capacity window; the change was reverted and the test is green again. - `spotless:check` passes; only the new test file is added. - No production code, configuration, or public API is changed. No new defect was found, so no issue is filed with this PR. -- 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]
