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

   ### Purpose of this pull request
   
   I confirm this contribution to **Apache SeaTunnel**. Thank you for 
maintaining the project.
   
   This PR adds one engine-level E2E test for Zeta and changes no production 
code. It pins the retention contract of the engine state store for a *finished* 
job versus a *running* job, a lifecycle boundary that the existing suite does 
not reach.
   
   #### The contract under test
   
   On a single in-JVM Zeta node configured with `history-job-expire-minutes = 
1` and a short `state-cleanup-delay-millis`:
   
   1. A job that reaches `FINISHED` keeps its status, metrics and DAG in 
`engine_finishedJobState`, `engine_finishedJobMetrics` and 
`engine_finishedJobVertexInfo`, and every one of those entries carries a finite 
TTL inside the configured window (the test reads the TTL through the public 
`IMap` API right after the `JobMaster` is released, so a unit change from 
minutes to seconds is also caught).
   2. While the window is open the terminal job stays fully observable without 
any `JobMaster` (`getJobStatus` = `FINISHED`, non-empty `getJobMetrics`, 
resolvable `getJobInfo`).
   3. When the window elapses all three entries are evicted, each store reports 
the eviction through its expiration listener (`getFinishedJobCleanupTotals`), 
and the coordinator no longer knows the job (`UNKNOWABLE`, empty metrics).
   4. A job that is still `RUNNING` over the whole window keeps its 
`engine_runningJobState` entry **without any TTL**, together with live metrics; 
neither the retention window nor another job's eviction may touch it.
   5. A job cancelled after the window has elapsed takes the same bounded path: 
it leaves a readable terminal history entry whose TTL is inside the configured 
window.
   
   #### Why this is a boundary with real regression risk
   
   All four IMaps are cluster-wide in-memory structures. A missing TTL silently 
turns finished-job history into an unbounded leak for every job a long-lived 
master ever ran, and nothing fails while it grows. A TTL applied to the *wrong* 
map is worse: a streaming job that outlives the retention window would lose the 
state read by the coordinator, the failover restore path and the REST API, and 
would silently become `UNKNOWABLE`. A `MINUTES` to `SECONDS` change would 
delete finished-job history one minute after a job ends while every functional 
status assertion still passes. Only an end-to-end run against a real node can 
see all three, because the TTLs are metadata written deep inside the 
terminal-state cleanup path.
   
   #### Why the existing coverage does not reach it
   
   - `JobHistoryServiceListenerCleanupTest` only checks that listener 
registrations are deregistered when the coordinator is cleared; it never runs a 
job.
   - `JobInfoDagStabilityRestIT` and `RecoveryLifecycleRestApiIT` read job info 
while it is present but never wait for a retention window to elapse.
   - The REST page tests assert what a page renders, not when the underlying 
entries expire.
   - No existing E2E inspects the TTL of finished-job entries, and none proves 
that a running job's state has no TTL at all.
   
   Related context (not fixed by this PR, no defect found): #10767 discusses 
differentiated retention of historical job runtime info, #12123 the 
retained-history listing path, and #11269 the finished-jobs API tolerating 
missing history. This test pins the current contract those changes must 
preserve.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. It adds a test and a test fixture only.
   
   ### How was this patch tested?
   
   - `FinishedJobHistoryRetentionIT` green three consecutive times on 
`origin/dev` @ `1e7e29a75b` with the pristine `seatunnel-engine-server` jar 
(sha256 `e3687ea6c3c4ebc9caffa94e8ad57c5d7dc5df90dcfa93ed219d91ce1339137a`): 
65.999 s, 65.85 s, 65.762 s. The suite run included `spotless:check` bound to 
`validate`.
   - Negative control: writing the finished-job state without the configured 
TTL (`put(key, value, 365, TimeUnit.DAYS)` in 
`JobHistoryService#storeFinishedJobState`) makes the new test fail in 8.6 s 
with `finished job state must carry a finite TTL inside the 1 minute history 
window, but its TTL was 31536000000ms`. The mutation was reverted, the pristine 
jar rebuilt (same sha256 as above) and the green runs repeated.
   - `ImportClassCheckTest`: 8/8, exit 0. `spotless:check`: exit 0. `git diff 
--check`: exit 0.
   
   ### Check list
   
   - [x] New test class only; no existing test or production file modified.
   - [x] ASF license header added to the new test and its config fixture.
   - [x] The test waits on conditions instead of fixed sleeps and fails with a 
diagnostic message.
   - [x] `spotless:apply` / `spotless:check` clean; `ImportClassCheckTest` 
clean.
   


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