Skip to content

[Fix][Zeta] Fix checkpoint retention after coordinator recreation - #12236

Open
zhangshenghang wants to merge 6 commits into
apache:devfrom
zhangshenghang:fix-12094-checkpoint-retention-after-reset
Open

zhangshenghang wants to merge 6 commits into
apache:devfrom
zhangshenghang:fix-12094-checkpoint-retention-after-reset

Conversation

@zhangshenghang

@zhangshenghang zhangshenghang commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Purpose

Restore checkpoint retention bookkeeping when a coordinator is recreated, while keeping fresh submissions and checkpoint-disabled jobs free of constructor-time retention listing.

The built-in LocalFile and HDFS storage plugins now enumerate checkpoint IDs from filenames through an additive optional storage SPI method. Retention does not load or deserialize all checkpoint payloads, and valid-named corrupt files remain eligible for deletion. Recovered IDs are deduplicated and sorted so the oldest IDs are retired first. After a new checkpoint completes, deletion trims the retained IDs to max-retained.

External storage plugins remain binary compatible through the default unsupported optional. The coordinator logs one warning when that capability is absent and preserves the plugin's prior bookkeeping behavior; plugins implement metadata-only enumeration to include pre-recovery checkpoints in retention. There is no payload-reading fallback. Existing checkpoint loading and restore error contracts are unchanged. English and Chinese storage documentation explains the capability and migration.

Fixes #12094.

Validation

  • Scoped Spotless passed for the server, storage SPI, LocalFile, HDFS and engine E2E modules; final patch whitespace check passed.
  • Independent maintainer review of the final repair passed for push with current-head GitHub CI required.
  • Existing manager tests cover explicit checkpoint restore and persisted-state master reconstruction with exact retained IDs4,5,6. Legacy original-SPI coverage verifies prior retention behavior and forbids payload enumeration fallback. The fresh checkpoint-disabled storage-access assertion remains1.
  • Storage tests enumerate corrupt payload files by metadata, assert exact pipeline filtering and confirm deletion preserves other pipelines.
  • Existing engine E2E now exceeds the retention window and asserts exactly3 retained files before retaining all prior corrupted-checkpoint restore/error/data-integrity assertions.
  • Local compile/tests/runtime validation were not run under the SeaTunnel CI-only policy. The new head requires its own GitHub CI results; earlier green CI does not validate this update.

@github-actions github-actions Bot added the Zeta label Sep 9, 2026

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Problem Does This PR Solve?

CheckpointCoordinator tracks completed checkpoint IDs in an in-memory ArrayDeque<String> completedCheckpointIds and uses its size to decide when to delete old checkpoints from checkpointStorage once more than max-retained are on disk. That deque is always initialized empty in the constructor. When a CheckpointCoordinator is recreated for a pipeline that already has checkpoints in persistent storage (this happens on every master failover / job-recovery for a still-running job, since CheckpointManager/CheckpointCoordinator are reconstructed once per active-master lifetime — CheckpointManager.java:149-160, CheckpointManager.java:96-109), the deque starts from zero even though storage may already hold up to max-retained (or more, pre-existing) checkpoint files for that job/pipeline. Retention bookkeeping then effectively forgets about everything written before the recreation, so old checkpoints beyond the configured retention window are never cleaned up until the deque organically re-fills — a checkpoint-storage leak across repeated failovers. This PR (1) restores completedCheckpointIds from checkpointStorage during construction and (2) replaces a fragile modulo-based batch-delete with a straightforward while (size > max) removeFirst() loop that keeps working correctly once the deque no longer always starts at a multiple of max-retained.

Cross-PR relationship: I did not find any overlap between this PR and #12235/#12237 (both scoped to SeaTunnelTask.close()) or #12238 (TaskExecutionService/TaskGroupContext). This PR's only touched production file is CheckpointCoordinator.java, which none of the other three touch. That said, this PR is thematically adjacent to #12238 in the sense that both are hardening a "state reconstructed after master failover / worker restart" scenario in the Zeta engine, which is consistent with this repository's recent history of E2E hardening in exactly this area (see the last several dev commits: "worker-restart restore with missing coordinator checkpoint state", "job behavior after a checkpoint-trigger failure", "task stuck in CANCELING when worker crashes mid-cancel"). No file or runtime-state conflict between them, though.

1. Code Change Review

1.1 Core Logic Analysis

File: seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointCoordinator.java

Constructor (line 224-226, unchanged, plus new line 227):

this.completedCheckpointIds =
        new ArrayDeque<>(coordinatorConfig.getStorage().getMaxRetainedCheckpoints() + 1);
restoreCompletedCheckpointIds();   // <-- new

New method (lines 1389-1409):

private void restoreCompletedCheckpointIds() {
    try {
        checkpointStorage
                .getCheckpointsByJobIdAndPipelineId(String.valueOf(jobId), String.valueOf(pipelineId))
                .stream()
                .map(PipelineState::getCheckpointId)
                .sorted()
                .map(String::valueOf)
                .forEach(completedCheckpointIds::addLast);
    } catch (Exception e) {
        LOG.warn("Failed to restore retained checkpoint IDs, job id: {}, pipeline id: {}", jobId, pipelineId, e);
    }
}

completePendingCheckpoint retention check, before:

if (completedCheckpointIds.size() % coordinatorConfig.getStorage().getMaxRetainedCheckpoints() == 0
        && completedCheckpointIds.size() / coordinatorConfig.getStorage().getMaxRetainedCheckpoints() > 1) {
    for (int i = 0; i < coordinatorConfig.getStorage().getMaxRetainedCheckpoints(); i++) {
        needDeleteCheckpointId.add(completedCheckpointIds.removeFirst());
    }
    ...
}

After:

if (completedCheckpointIds.size() > coordinatorConfig.getStorage().getMaxRetainedCheckpoints()) {
    while (completedCheckpointIds.size() > coordinatorConfig.getStorage().getMaxRetainedCheckpoints()) {
        needDeleteCheckpointId.add(completedCheckpointIds.removeFirst());
    }
    ...
}

Key findings:

  • I traced new CheckpointCoordinator(...)'s only call site (CheckpointManager.java:149) and new CheckpointManager(...)'s only call site (JobMaster.java). Both are constructed exactly once per active-master lifetime for a given job — i.e. on initial job submission and on master-failover recovery for a still-running job. This confirms the bug is reachable via the failover/recovery boundary path, not the steady-state per-checkpoint hot path — the normal per-checkpoint-completion code in completePendingCheckpoint was already correct in intent, just fragile once the deque could start non-empty.

  • The trim-logic rewrite is not cosmetic — it's required by change (1). The old size % max == 0 && size / max > 1 condition only ever fires when the deque grows to an exact multiple of max, which was true by construction when the deque always started at 0 and grew one at a time. Once restoreCompletedCheckpointIds() can leave the deque at an arbitrary starting size (e.g. 5, as in the new test, with max=3), the modulo condition would never trigger correctly (5 % 3 = 2 ≠ 0), so restoring the IDs without also fixing the trim condition would not have solved the reported problem. The while loop is the correct, invariant-preserving replacement (size <= max after every completion) and also happens to fix a pre-existing, separate cosmetic imprecision in the old code (it let retained-checkpoint count oscillate up to 2*max - 1 between trims even in the steady-state, never-recreated case) — a beneficial side effect, but one that changes user-observable on-disk checkpoint counts even outside the recreation scenario, worth calling out explicitly in the PR description as an additional (welcome) behavior change beyond just "fix retention after recreation."

  • restoreCompletedCheckpointIds() is defensively wrapped in catch (Exception e) with a LOG.warn, so a storage-layer failure during restoration degrades to the pre-PR behavior (empty deque) rather than blocking coordinator construction — reasonable, but see Issue 1 below regarding a CI-observed regression this restoration call actually causes.

  • I checked whether getCheckpointsByJobIdAndPipelineId could pull in a SAVEPOINT_TYPE checkpoint that the retention while-loop would then delete as if it were an ordinary rolling checkpoint. Confirmed: completedCheckpointIds.addLast(...) (line 1327, unmodified by this PR) is called unconditionally for every completed checkpoint type, including savepoints — so yes, restored savepoint IDs are just as eligible for automatic deletion as regular checkpoints once the retention window is exceeded. This is pre-existing behavior, not introduced by this PR (the deque already mixed savepoints with regular checkpoints before this change), so I'm not scoring it against this PR specifically, but the fix now makes that pre-existing characteristic apply consistently across failovers too, which is worth the maintainers being aware of if it wasn't already an intentional choice.

  • Runtime-path diagram:

    Master failover (new master elected) OR fresh job submit
      -> JobMaster reconstructed for the job
        -> new CheckpointManager(...)                         (JobMaster.java)
          -> new CheckpointCoordinator(...) per pipeline       (CheckpointManager.java:149-160)
            -> completedCheckpointIds = new ArrayDeque<>()     (always starts empty)
            -> restoreCompletedCheckpointIds()                 <-- NEW: backfills from checkpointStorage
                 -> checkpointStorage.getCheckpointsByJobIdAndPipelineId(jobId, pipelineId)
    ...later, steady state...
    Task acks complete a checkpoint
      -> CheckpointCoordinator.completePendingCheckpoint(...)
           -> completedCheckpointIds.addLast(newId)
           -> while (size > max) checkpointStorage.deleteCheckpoint(oldestIds)   <-- rewritten trim loop
    

1.2 Compatibility

Functionally compatible in scope (no config option renamed, no serialized checkpoint format touched, no new required config), but see Issue 1 — the change is not compatible with the test suite's own expectations about the storage-access footprint of coordinator construction, which is a real regression, not just a style nit.

1.3 Performance / Side-Effect Analysis

restoreCompletedCheckpointIds() adds one synchronous checkpointStorage.getCheckpointsByJobIdAndPipelineId(...) call per pipeline on every CheckpointCoordinator construction — including for every fresh job submission and every batch job with checkpointing effectively disabled, not just failover recovery. For a fresh job this call will almost always return an empty list (nothing stored yet), so it's wasted I/O on the by-far-most-common path (every job start). This isn't just a performance nit — it is the direct, confirmed cause of Issue 1 below (a CI-observed test regression). At "百亿级" per-task production scale with many concurrently-starting pipelines, an unconditional extra storage round-trip per pipeline construction (multiplied across every job submission, not just failovers) is worth gating — e.g. skip the call entirely when isStartWithSavePoint/isRestoreJob is false, or only invoke it lazily on the first completePendingCheckpoint call rather than eagerly in the constructor.

1.4 Error Handling and Logging

restoreCompletedCheckpointIds()'s catch (Exception e) + LOG.warn is appropriate defensive handling and does not swallow silently (it logs full context: jobId, pipelineId, exception). No sensitive data logged. No issues here.

2. Code Quality Assessment

2.1 Coding Standards

restoreCompletedCheckpointIds() has a one-line Javadoc ("Restores persisted checkpoint IDs so retention survives coordinator recreation.") — present, though it doesn't explain the why (recreation loses the in-memory deque) or the ordering contract (must sort ascending before addLast, since completePendingCheckpoint's removeFirst() assumes oldest-first ordering) that a future maintainer changing this method would need to preserve. I'd ask for a short expansion here given how easy it would be to silently break retention ordering again.

2.2 Test Coverage and Test Stability

New test: CheckpointManagerTest.testCheckpointRetentionAfterCoordinatorRecreation (lines 275-311) — stores 5 checkpoints directly via storeCompletedCheckpoint, creates a CheckpointManager/CheckpointCoordinator with max-retained=3, completes checkpoint 6, and asserts the retained set is exactly [4, 5, 6]. This is a well-targeted, deterministic unit test that directly exercises the reported defect (no Thread.sleep, no nondeterministic external state, no ordering dependency) — in isolation, Stable.

However — I ran the PR's own fork CI logs and found this PR breaks two pre-existing, unmodified tests that this diff does not touch:

  • CheckpointStorageTest.testBatchJobResetCheckpointStorage — failed: expected: <1> but was: <2>. This test swaps in a fake CheckpointStorage that increments an accessCounter on every call, runs a batch job with checkpointing effectively disabled (BATCH_CONF_WITHOUT_CHECKPOINT_INTERVAL_PATH), then makes exactly one explicit call to getAllCheckpoints itself and asserts the counter is 1 (i.e., the storage backend should receive zero calls during the entire job lifecycle before the test's own explicit call). This PR's new, unconditional restoreCompletedCheckpointIds() call in the CheckpointCoordinator constructor adds exactly one extra storage call at coordinator-construction time — for every job, including batch jobs with checkpointing off — which is precisely why the counter is now 2 instead of 1. This is a direct, mechanically-verified causal link, not a guess.
  • CheckpointStorageTest.testGenerateFileWhenSavepoint — failed: expected: <1> but was: <0> (a stream job takes a savepoint, then asserts exactly one checkpoint file exists in storage; zero were found). I traced this as far as confirming it is not explained by the rewritten while-loop trim logic under this test's config (max-retained defaults to 20, and only a single savepoint checkpoint is produced here, so 1 > 20 never triggers a delete either before or after this PR). I was not able to fully pin down the exact mechanism within my review time budget, but given it fails in the same PR's CI run, on the same CheckpointCoordinator class this PR modifies, and does not fail on dev, I am treating this as PR-caused rather than environmental — this is a flag for the author to investigate directly rather than a confirmed root cause on my part (explicitly marking this second data point as inference, not a proven mechanism, unlike the first one above).
  • A third data point from the same CI run: SplitClusterFaultToleranceIT also errored (not merely failed) in engine-v2-it (8, ubuntu-latest). I have not root-caused this one and note it only as corroborating signal that something in this PR's checkpoint-coordinator lifecycle path is destabilizing more than the one file it explicitly touches.

Given two pre-existing, unmodified tests now fail deterministically because of this diff, and a third IT test also fails in the same run: Stability rating for this PR as a whole: High risk. The new unit test the PR adds is fine on its own; the regression is in tests the PR did not touch, which is exactly the kind of side effect the "Test Coverage and Test Stability" review criterion exists to catch. This is a formal blocking Issue per the review protocol (see Issue 2 below).

2.3 Documentation Updates

No docs/en / docs/zh change needed — docs/en/engines/zeta/checkpoint-storage.md documents max-retained as "the maximum number of retained checkpoints," and the rewritten while-loop trim logic makes the implementation match that description more precisely than before (the old code could transiently retain up to 2*max - 1), so no doc correction is required; if anything this PR fixes a latent doc/implementation mismatch.

3. Architectural Soundness

3.1 Elegance of the Solution

Precise fix in intent (restore + correct the trim invariant are a coupled, necessary pair, and the reasoning for why both changes are needed together is sound), but the implementation of the restoration step is not yet production-ready — it needs to avoid the unconditional extra I/O call on every coordinator construction (see Issue 1/Section 1.3) before this qualifies as a clean, ready-to-merge fix.

3.2 Maintainability

The while-loop rewrite is more readable and easier to reason about than the modulo-based batch-delete it replaces — a net maintainability improvement independent of the recreation-restoration feature.

3.3 Extensibility

Restoring from checkpointStorage at construction time is the right general approach for keeping in-memory retention bookkeeping consistent with durable state; it would benefit from being conditioned on whether the pipeline is actually being recovered (isStartWithSavePoint/restore context is already available one layer up in CheckpointManager.java:131-148) rather than running unconditionally for every coordinator, which would also resolve the performance/test-regression issue in one move.

3.4 Historical-Version Compatibility

No checkpoint/savepoint serialization format, protocol field, or historical task JSON is touched — this is purely in-memory bookkeeping plus storage-directory listing/deletion calls that already existed. Safe for rolling upgrade from a version-compatibility standpoint; the operational risk here is the CI-confirmed test regression above, not upgrade compatibility.

4. Issue Summary

Number Issue Location Severity
1 restoreCompletedCheckpointIds() runs unconditionally on every CheckpointCoordinator construction (including fresh job submits and checkpoint-disabled batch jobs), adding an extra storage round-trip that directly breaks the pre-existing CheckpointStorageTest.testBatchJobResetCheckpointStorage (CI-confirmed: expected: <1> but was: <2>) CheckpointCoordinator.java:227, CheckpointCoordinator.java:1389-1409 High
2 Same PR's CI run also fails the pre-existing, unmodified CheckpointStorageTest.testGenerateFileWhenSavepoint (expected: <1> but was: <0>) and errors SplitClusterFaultToleranceIT; root mechanism not fully isolated in this review but consistent with the same change and not reproducible on dev CheckpointStorageTest.java:70-95, SplitClusterFaultToleranceIT High
3 restoreCompletedCheckpointIds()'s Javadoc doesn't document the ordering contract (addLast after ascending sort) that completePendingCheckpoint's removeFirst()-based trim depends on CheckpointCoordinator.java:1389-1391 Low

5. Merge Recommendation

Conclusion: Not recommended for merge

  1. Blockers — must be fixed

    • Issue 1 & 2: This PR's own fork CI run fails two pre-existing unit tests (CheckpointStorageTest.testBatchJobResetCheckpointStorage, CheckpointStorageTest.testGenerateFileWhenSavepoint) and errors one IT (SplitClusterFaultToleranceIT) that pass on dev. I have a direct, mechanically-verified causal chain for the first failure (the new unconditional constructor-time storage call), and treat the other two as PR-caused-but-not-fully-root-caused given they fail in the same run on the same modified class and not on dev. Per this project's testing discipline, a change that breaks existing tests must not be merged until the root cause is fixed and the full existing test suite is green again — this is not a matter of loosening or skipping those tests, but of fixing the new code so it doesn't regress them (most likely by gating restoreCompletedCheckpointIds() behind the existing restore/recovery context rather than calling it unconditionally, per Section 3.3).
  2. Recommended fixes — non-blocking (address once the blockers above are resolved)

    • Expand the Javadoc on restoreCompletedCheckpointIds() to document the ordering contract it must preserve (Issue 3).
    • Call out in the PR description that the rewritten trim loop also changes steady-state (non-recreation) retention behavior from "up to 2*max-1 transiently" to "always <= max" — this is a welcome, more-correct behavior, but is a second, distinct behavior change bundled into the same PR and worth being explicit about.

Overall assessment: the diagnosis (in-memory retention bookkeeping doesn't survive coordinator recreation) is real and the two-part fix (restore + correct the trim invariant) is the right shape of solution. However, the current implementation is not safe to merge as-is: it has a CI-confirmed regression against existing, unmodified tests, most likely because the restoration call runs unconditionally on every coordinator construction rather than being scoped to when it's actually needed (recovery/failover). This needs a fix-and-reverify cycle before it's ready.

@davidzollo

Copy link
Copy Markdown
Contributor

Updated the original branch at 28b3f2575d3f. Fresh/checkpoint-disabled construction no longer lists retention history. Recreated coordinators use metadata-only ID enumeration in both built-in storage plugins, avoiding full checkpoint payload materialization and retaining corrupt-file IDs for normal retirement. The optional default preserves external storage SPI compatibility with an explicit warning and documented capability limitation. Storage, restore, legacy-plugin and existing engine E2E regression coverage was updated; scoped formatting and independent repair review passed. This head requires new GitHub CI results.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, and sorry for the long gap since my first review. The head moved a lot: commit 28b3f2575d (pushed by @davidzollo to the author's branch) reworks the restoration approach, and cab2184d22 merges dev. I re-read the complete current diff and the surrounding call chain at the new head instead of relying on my earlier notes.

What Problem Does This PR Solve?

  • User pain point: CheckpointCoordinator tracks completed checkpoint IDs in an in-memory deque and trims storage by its size. After a coordinator is recreated (master failover or recovery of a still-running job) the deque starts empty, so checkpoints written before the recreation are never retired and storage grows without bound across failovers (#12094).
  • Fix approach: on recreation only, re-populate the deque from checkpoint storage through a new metadata-only SPI method, and replace the modulo-based batch trim with a while (size > max-retained) loop.
  • One-sentence summary: make max-retained retention survive coordinator recreation without reading checkpoint payloads.

1. Code Change Review

1.1 Core Logic Analysis

Runtime path:

master failover / job recovery -> CheckpointManager builds CheckpointCoordinator (once per active-master lifetime)
  -> ctor: isCheckpointEnable() && (isStartWithSavePoint || IMap status entry != null)   // new gate
       -> restoreCompletedCheckpointIds()
            -> CheckpointStorage.getCheckpointIdsByJobIdAndPipelineId()  // new default method
                 LocalFileStorage / HdfsStorage: list file names only, filter by pipeline, parse id
            -> distinct().sorted() -> completedCheckpointIds.addLast(...)
  -> later completePendingCheckpoint(): addLast(new id); while size > max -> removeFirst -> deleteCheckpoint(list)

What I re-verified:

  • The gate fixes my earlier blocker. My first review found that an unconditional listing in the constructor broke CheckpointStorageTest.testBatchJobResetCheckpointStorage (an extra storage access for a fresh checkpoint-disabled batch job). Now a fresh submission has no checkpoint_state_<job>_<pipeline> IMap entry and no restore flag, and checkpoint-disabled jobs are excluded by isCheckpointEnable(), so the constructor does no listing for them. The test now asserts exactly that (accessCounter == 1) and also restores the original storage in a finally.
  • Metadata-only enumeration: LocalFileStorage and HdfsStorage list file names, filter by getPipelineIdByFileName, and parse getCheckpointIdByFileName; no payload is read or deserialized. A missing directory returns a present empty list (HDFS getFileNames returns an empty list when the path does not exist). Valid-named corrupt files stay in the list, so normal retention can delete them, which the two new storage tests prove.
  • SPI compatibility: the new default Optional<List<Long>> getCheckpointIdsByJobIdAndPipelineId returns Optional.empty(), so external plugins keep compiling and loading; the coordinator logs one warning and keeps the old behavior with no payload fallback. This is the right call for a pluggable SPI.
  • Trim loop: while (size > max) keeps the invariant size <= max after every completion, so the restored deque can start at any size. The ascending sorted() plus addLast is the ordering contract removeFirst() depends on, and it is now documented in the Javadoc (my earlier Issue 3 is resolved).
  • Failure mode: any exception during restoration is caught and logged at WARN, and the coordinator then behaves as before (retention under-counts). That is an acceptable fail-open for a cleanup feature, not a swallowed correctness error, because checkpoint writing and restore are not affected.

1.2 Compatibility Impact

Partially incompatible (behavior only, no data or protocol format change).

  • Steady-state retention changes for everyone, not only after recreation: before, storage could hold up to 2*max-1 checkpoints between batch trims (trim fired only when size % max == 0 && size / max > 1); now it holds at most max-retained. This matches the documented meaning of max-retained, but users who relied on the extra on-disk checkpoints will see fewer. I flagged this in my first review as a welcome behavior change that should be called out; it is now described in the checkpoint-storage docs, but there is no entry in docs/en/introduction/concepts/incompatible-changes.md (see Issue 2).
  • No change to checkpoint file names, serialization, PipelineState or savepoint formats; restore and rolling upgrade are not affected.

1.3 Performance / Side-Effect Analysis

  • One directory listing per recreated coordinator, filenames only, so cost scales with the number of retained files and not with payload size. This is fine at the target scale.
  • One-time cost: when a job has already leaked a large backlog of old checkpoints (the very bug being fixed), the first completed checkpoint after recovery deletes the whole backlog in one deleteCheckpoint(jobId, pipelineId, List) call. For HDFS or an object store behind it this may be a large batch on the checkpoint-completion path. It is a one-time cleanup and is bounded by the existing backlog, so I do not consider it blocking, but it is worth knowing about.
  • No new threads, no hot-path allocation beyond the deque.

1.4 Error Handling and Logging

No source-side blocker. Issues:

Issue 1: One unparsable file name aborts the whole ID listing

  • Location: CheckpointCoordinator.java restoreCompletedCheckpointIds() catch block; HdfsStorage.java / LocalFileStorage.java getCheckpointIdsByJobIdAndPipelineId
  • Problem: one unparsable file name makes Long.parseLong throw, which aborts the whole enumeration; the whole list is then dropped and the retention state for that pipeline stays empty. Files in the checkpoint directory are written by the storage plugin itself, so this is unlikely.
  • Potential risk: low; the result is the pre-PR behavior plus a WARN with a stack trace.
  • Best improvement: skip an unparsable entry with a debug or warn line instead of failing the entire listing (optional).
  • Severity: Low
  • Raised by another reviewer: no

Issue 2: Steady-state retention change is not recorded as an incompatible change

  • Location: docs/en/introduction/concepts/incompatible-changes.md (not touched); behavior in CheckpointCoordinator.java completePendingCheckpoint()
  • Problem: the project rule asks for user-visible behavior changes to be listed there. The checkpoint-storage page describes the new retention, but the change from "up to 2*max-1 on disk" to "at most max-retained" is not listed as a behavior change.
  • Potential risk: operators sizing storage or relying on older checkpoints as manual fallbacks are surprised.
  • Best improvement: add a short entry in incompatible-changes.md (en and zh).
  • Severity: Medium (non-blocking)
  • Raised by another reviewer: no

Issue 3: zh documentation is in English

  • Location: docs/zh/engines/zeta/checkpoint-storage.md (new ### Retention after recovery section, +23 lines)
  • Problem: the section is the same English text as docs/en, while the rest of the zh page is Chinese.
  • Potential risk: zh readers get an untranslated section; no functional risk.
  • Best improvement: translate the section and heading.
  • Severity: Low
  • Raised by another reviewer: no

2. Code Quality Assessment

2.1 Coding Standards

Javadoc on the SPI method, the two implementations and restoreCompletedCheckpointIds() explains the contract (unordered or duplicate IDs allowed, empty optional means unsupported, corrupt files must still be listed). The inline comments explain the gate and the fail-open. Good.

2.2 Test Coverage and Test Stability

Rating: Stable, with one small watch item.

  • CheckpointManagerTest.testCheckpointRetentionAfterCoordinatorRecreation (parameterized over explicit restore and IMap-status recreation) proves 5 stored plus 1 new ends at [4,5,6] with max-retained=3; testLegacyStorageKeepsPriorRetentionWithoutPayloadFallback proves a plugin that only has the default method never has its payload method called (it throws AssertionError if it is) and keeps the old behavior.
  • LocalFileStorageTest and AbstractFileCheckPointTest (HDFS) cover a corrupt-payload file still listed and deletable, other pipelines untouched, and a missing job directory. No sleeps, no fixed ports; a @TempDir is used for local files.
  • CheckpointRestoreWithStopIT is strengthened, not weakened: it waits for 5 completed checkpoints instead of 2 and asserts exactly 3 files remain. CheckpointStorageTest.testBatchJobResetCheckpointStorage keeps its assertion and only gains a finally restore. Watch item: the exact 3 depends on this module's configured max-retained of 3 and on retention running inside checkpoint completion; since the job is stopped before the listing it should be stable, but if it ever flakes, that assertion is the first place to look. The now-redundant size() >= 2 assertion right after it can be dropped.

2.3 Documentation Updates

docs/en and docs/zh both gain a section, but see Issue 3 for the untranslated zh text and Issue 2 for the missing incompatible-changes entry.

3. Architectural Soundness

3.1 Elegance

Precise fix: the restoration is gated to where it is needed, and the SPI addition is additive and optional.

3.2 Maintainability

Improved: the while trim is simpler than the modulo logic and keeps working for any starting size.

3.3 Extensibility

Third-party storage plugins can opt in by implementing one method; the empty-optional contract is clear and documented.

3.4 Historical-Version Compatibility

No persisted format change. Plugins built against the old SPI still load. Only the retention count behavior described in Issue 2 differs from older releases.

4. Issue Summary

Number Issue Location Severity
2 Steady-state retention change not listed in incompatible-changes docs/en/introduction/concepts/incompatible-changes.md Medium (non-blocking)
1 One bad file name aborts the whole ID listing HdfsStorage.java, LocalFileStorage.java, CheckpointCoordinator.java Low
3 zh section is untranslated English docs/zh/engines/zeta/checkpoint-storage.md Low

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers (must fix): no source-side blocker. The only open gate is CI: the current Build for head cab2184d22 is still IN_PROGRESS, and it must finish green, in particular the checkpoint unit tests and CheckpointRestoreWithStopIT, which my first review found failing before the gate was added.
  2. Recommended fixes (non-blocking): the incompatible-changes entry, translating the zh section, and skipping an unparsable file name instead of failing the listing.

Overall assessment: the diagnosis was real, and the new revision answers my earlier blocker properly (gated restoration, metadata-only listing, SPI-safe default). A note on process: this head was pushed by @davidzollo to the author's branch, so @zhangshenghang please pull it before pushing again.

CI and sync status (live, head cab2184d22): Build is IN_PROGRESS on the fork run; Signal pull request update is green. The previous run on 28b3f2575d failed Code style with a Lombok ExceptionInInitializerError on a new runner image (not a spotless finding in this PR) plus the non-blocking Dead links job. The branch is 0 commits behind dev and has no conflict, so no sync is needed. This review is by code reading only; nothing was built or run locally.

@DanielLeens DanielLeens left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up. I re-read all eleven changed files and the coordinator/storage/recovery chain. The earlier unconditional storage-call blocker is fixed, and metadata-only enumeration avoids loading checkpoint payloads. I also need to correct my earlier CI attribution: the savepoint-count and worker-loss failures were not established as caused by this PR, and a deterministic access-count failure should not have been called a flaky-test diagnosis. Sorry for that overstatement. The bounded-wait suggestion below is an older test-hygiene omission, not a new regression.

What problem this PR solves

  • User pain: Recreating a checkpoint coordinator loses its in-memory retention queue, so persisted checkpoints from earlier master lifetimes can escape the configured retention window.
  • Fix approach: Restore sorted/deduplicated IDs only for checkpoint-enabled recovery/recreation, add an optional metadata-only storage capability, and trim oldest IDs to the configured maximum on checkpoint completion.
  • One-line summary: Keep retention aware of persisted history across recovery without scanning payloads on every fresh job.

Example: Storage contains IDs 1-5 and max-retained=3. After recreation and checkpoint 6, built-in storage retains 4,5,6; a legacy plugin without metadata enumeration keeps its prior behavior and emits a capability warning.

1. Code-change review

1.1 Core logic analysis

Eleven files, +398/-26: coordinator, storage SPI/LocalFile/HDFS implementations, existing UT/IT and EN/ZH retention guidance. The complete target-relative diff was read at cab2184d2263d66e0d1cc0150edfe74631867d21, not just the latest commit. Production recovery/retention behavior plus backward-compatible storage capability and regressions.

Before / after:

Before: coordinator queue empty after recreation; modulo/batch trimming forgets old files
Earlier revision: unconditionally reads full persisted states on construction
Now: enabled AND (explicit restore OR persisted coordinator state) -> metadata IDs only
     Optional.empty means unsupported; present empty list means supported/no files
     distinct -> ascending -> queue tail
Completion: append new ID -> persist -> while size > max remove oldest -> delete IDs

Complete relevant execution chain:

JobMaster -> CheckpointManager constructor():135-224
  -> restore checkpoint state using existing loading/error behavior
  -> new CheckpointCoordinator(..., isRestoreJob, ...):223-310
  -> checkpoint-enabled + restore/status guard:279-287
  -> restoreCompletedCheckpointIds():1455-1489
     -> CheckpointStorage optional default:104-109 (no payload fallback)
     -> LocalFileStorage:278-302 lists .ser names; HdfsStorage:240-258 uses listStatus
     -> pipeline filter -> parse IDs -> distinct/sort -> queue
Task ACK completion -> synchronized completePendingCheckpoint():1381-1434
  -> store checkpoint payload as before -> trim queue -> delete oldest files
Recovery from another job keeps that source job's checkpoint-loading rules; retention lists the current job/pipeline, not unrelated source-job files
CheckpointRestoreWithStopIT:239-260 waits for five completions, stops job, asserts three retained files before corrupting latest

Key findings:

  1. Fresh submissions and checkpoint-disabled batch construction avoid the new enumeration path, closing previous Issue 1.
  2. LocalFile/HDFS only inspect filesystem metadata; corrupt bytes with valid filenames remain visible for deletion without deserialization.
  3. The default optional method preserves existing external implementations and deliberately reports unsupported capability rather than materializing full payloads.
  4. Trimming is exact after completion and handles arbitrary restored queue sizes, not only multiples of the limit.
  5. Existing checkpoint loading/corrupt-restore behavior is unchanged. Savepoint/terminal-marker retention policy remains a separate pre-existing concern, not a newly inferred data-loss finding.

Community context: No independent non-Daniel Review/inline finding is present. @davidzollo's update describes the recovery guard and metadata-only approach, both confirmed in the current code. Prior source/test conclusions are reassessed here rather than treating old-head CI as current.

1.2 Compatibility impact

Fully compatible SPI/API and persisted formats, with an observable retention correction. The new interface method has a default; no configuration/default, protocol or checkpoint serialization field changes. Built-in storage honors the maximum after completion instead of the old oscillating batch window. Legacy external plugins retain prior retention bookkeeping until implementing metadata-only IDs; this limitation and the warning are documented. No binary migration or payload rewrite is needed.

1.3 Performance / side effects

Fresh-job startup avoids extra storage I/O. Recovery lists filenames and sorts/distincts O(N) IDs, rather than loading all checkpoint payload bytes. Recovery still incurs metadata listing and O(N) ID memory for an accumulated backlog; HDFS-backed object stores incur their normal list cost. Completion deletion is under the existing synchronized lifecycle, with tighter per-completion retention. No new threads, locks, networking protocol, retry or idempotency mechanism is added.

1.4 Error handling and logging

Unsupported enumeration logs a contextual capability warning; enumeration failure logs job/pipeline and retains prior bookkeeping behavior. Existing actual checkpoint-loading failures remain unchanged rather than being hidden by a metadata fallback. Deletion/storage exceptions continue through existing failure handling; no credentials or payloads are added to logs.

Issue 3: Translate the new Chinese documentation section

  • Location: docs/zh/engines/zeta/checkpoint-storage.md:396-418.
  • Problem: The entire new Retention after recovery section is copied in English into the Chinese guide, including the important external-plugin capability limitation.
  • Risk: The Chinese documentation does not deliver the requested localized explanation of recovery retention and legacy-plugin behavior.
  • Best fix: Translate this section while keeping the exact option/SPI names and supported-versus-unsupported Optional semantics aligned with EN.
  • Severity: Medium, required documentation. Raised by another reviewer: No.

Issue 4: Bound the existing job-process waits in the modified restore scenario

  • Location: seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointRestoreWithStopIT.java:245.
  • Problem: The bounded source-job status wait is followed by an unbounded sourceJobFuture.get for external CLI completion. The restore result in this same scenario already uses get(2, TimeUnit.MINUTES) and is correctly bounded. Reaching a job status does not guarantee the CLI process has exited.
  • Risk: A process-exit regression can hold the fork until its outer timeout and obscure the failing step.
  • Best fix: Bound the source-job get call with a useful process/job diagnostic and finally-based cleanup. Keep the condition-based checkpoint/status waits.
  • Severity: Medium, non-blocking test-stability recommendation. Raised by another reviewer: No; pre-existing omission acknowledged above.

2. Code-quality assessment

2.1 Code conventions

New SPI/core methods document metadata-only behavior, unsupported capability and oldest-first ordering. Explicit imports and ASF conventions are consistent; scoped whitespace check is clean. The scoped whitespace check produced no entries.

2.2 Test coverage and stability

Stability rating: Risk present, due to the existing external-process future waits in Issue 4. The new storage-ID cases use @tempdir or a UUID job namespace, corrupt fixed bytes deliberately, verify other pipelines survive and clean up their own HDFS files. The coordinator cases exercise explicit restore and persisted-status reconstruction and assert sorted ID sets; they do not depend on filesystem iteration order. No local build, unit/integration test, container or service was run. CheckpointStorageTest now restores the swapped shared storage in finally while preserving the exact original fresh-batch access-count assertion. The legacy adapter throws if payload enumeration is attempted, making the no-fallback contract executable. The existing IT extends retention beyond the maximum before corrupting the latest retained file; it does not claim to add corrupt-checkpoint fallback.

Current-head fork Build 40171904704 is in progress. The available first-page job snapshot shows Java 11 unit tests, Java 17 Windows unit tests, Java 17 engine IT, website and dependency licensing succeeded; Java 11 engine IT 121179732991 is still running. The connector returned only the first 30 jobs after the full REST listing failed with 502, so this is not a whole-matrix pass claim. No current failed lane has been identified in that snapshot; do not reuse the old failures or prescribe a sync without evidence.

2.3 Documentation

EN accurately documents the recovery-only guard, metadata enumeration and external-plugin limitation. Translate the matching ZH section (Issue 3); there is no incompatible format migration to document.

3. Architectural soundness

3.1 Solution quality

A precise recovery-bookkeeping fix with an explicit optional capability instead of a payload-heavy compatibility fallback.

3.2 Maintainability

The Optional capability clearly distinguishes unsupported from supported-empty. Tests pin both plugin compatibility and built-in corruption-tolerant ID discovery.

3.3 Extensibility

External plugins can implement metadata-only IDs without replacing existing loading/restoration methods.

3.4 Historical compatibility

Default SPI behavior preserves older plugins. Retention becomes exact for built-ins, while checkpoint bytes and restore selection are unchanged.

4. Findings summary

Number Finding Location Severity
3 New ZH section remains English checkpoint-storage.md:396-418 Medium, required
4 Unbounded source CLI result wait CheckpointRestoreWithStopIT.java:245 Medium, non-blocking

Previous unconditional-enumeration blocker is closed; earlier unproven CI causality is withdrawn.

5. Merge conclusion

Conclusion: Can merge after fixes

  1. Blocking items: Translate Issue 3 and obtain the completed current-head required CI plus effective maintainer approval. No remaining demonstrated retention-logic blocker was found.
  2. Non-blocking recommendations: Issue 4 bounded process waits; keep the metadata-only and legacy-plugin regressions. Do not add corrupt-checkpoint fallback or unrelated worker-loss fixes here.

The implementation now addresses the actual retention defect without the earlier startup/payload cost. The remaining required source-delivery change is small documentation work; runtime clearance still depends on the current Build.

Compare against dev: ahead, ahead 4 / behind 0, merge conflict=False. Drift is recorded independently; it does not itself justify a sync-first comment without an unrelated CI failure.

Daniel has READ permission. This COMMENT is a technical assessment, not an effective write-level approval. A write-capable maintainer must confirm repository gates and supply the effective approval.

Local evidence: exact-head fetch/checkout on seatunnel-review-12236, complete diff and source call-chain reads cited above. No runtime verification was claimed.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zhangshenghang and @davidzollo for the careful follow-up. I re-read the complete current diff at head c1c201368963. Compared with my last review at cab2184d2263, the new commits are two dev merges (31ea5a93) and c1c2013689 (zh translation of the retention section); I checked that the PR-owned engine, storage SPI, plugin and test files are unchanged. This is a code-reading review; nothing was executed locally, but I did read the exact-head CI (section 2.2).

CI was the remaining blocker, and the previously required item (the untranslated zh section) is now fixed, so the conclusion is being changed to approve. Also, sorry: while tracing the full recovery chain again for this pass I found a few Low-severity points I should have raised in my earlier rounds (Issues 2 to 5 below). None of them is a blocker.

What Problem Does This PR Solve?

  • User pain point: CheckpointCoordinator keeps retention bookkeeping (completedCheckpointIds) in memory only. After a master failover the coordinator is recreated with an empty queue, so checkpoints persisted by the earlier master lifetime are never retired, and the old modulo/batch trimming let storage hold up to about twice max-retained.
  • Fix approach: on recreation for a restore (checkpoint-enabled only), read the persisted checkpoint IDs through a new optional, metadata-only SPI method, add them in ascending order, and trim exactly to max-retained after every completion.
  • One-sentence summary: retention now survives coordinator recreation without scanning checkpoint payloads on fresh jobs.

1. Code Change Review

1.1 Core Logic Analysis

Before / after:

Before: completedCheckpointIds empty after recreation; trim only when size % max == 0 && size / max > 1
After:  checkpoint enabled AND (isStartWithSavePoint OR persisted coordinator status)
          -> restoreCompletedCheckpointIds(): metadata IDs -> distinct -> ascending -> addLast
        on completion: addLast(new id) -> store payload -> while (size > max) removeFirst -> delete those IDs

Real call chain (verified at this head):

JobMaster.initCheckPointManager(restart)            JobMaster.java:335-352   (isRestoreJob = isRestoreJob() || restart)
 -> new CheckpointManager(...)                       CheckpointManager.java:133-215   one coordinator per pipeline per JobMaster lifetime
   -> new CheckpointCoordinator(..., isRestoreJob)   CheckpointCoordinator.java:213-310
      -> guard isCheckpointEnable && (isStartWithSavePoint || status != null)   :281-287
      -> restoreCompletedCheckpointIds()             :1461-1490
         -> CheckpointStorage.getCheckpointIdsByJobIdAndPipelineId (default Optional.empty)   CheckpointStorage.java:90-107
         -> LocalFileStorage:275-299 / HdfsStorage:237-256: file-name metadata only, filtered by pipeline id
task ACK -> completePendingCheckpoint (synchronized) :1381-1435 -> trim loop :1406-1415
         -> checkpointStorage.deleteCheckpoint(job, pipeline, ids)
  • Does the normal path reach it? The trim loop runs on every checkpoint completion of every checkpoint-enabled job, so it is main-path. The restore path is reached only on a master failover/restart restore or a restore-from-checkpoint submission; fresh submissions and checkpoint-disabled batch jobs skip enumeration (CheckpointCoordinator.java:283-287).
  • Coordinator lifetime check: the coordinator map is built once in the CheckpointManager constructor, so an in-lifetime pipeline restart reuses the same queue and no restore is needed there. That is why restoring only on recreation is the correct place.
  • Ordering and dedupe: file names are timestamp-random-pipelineId-checkpointId.ser; the plugins filter by pipeline id and parse the checkpoint id with the same helpers the rest of the storage uses (AbstractCheckpointStorage.java:177-189), then distinct().sorted() makes removeFirst() the oldest ID regardless of directory listing order.
  • Metadata only: neither plugin opens a file, so a corrupt payload with a valid name is still enumerated and can be retired; the default method returns Optional.empty() and the coordinator logs one warning and keeps the prior behavior, never falling back to reading payloads.
  • Restore failure path: restoreCompletedCheckpointIds catches Exception and logs a WARN with the stack, so a storage failure never blocks recovery; the cost is that retention then silently behaves as before for that lifetime.

1.2 Compatibility Impact

Fully compatible at the SPI, config and persisted-format level. The new CheckpointStorage method is a Java 8 default, so external plugins keep working; no checkpoint serialization, configuration key or default changes. The only observable behavior change is intended and documented in docs/en and docs/zh: for max-retained > 1 built-in storage now holds exactly max-retained checkpoints after each completion instead of oscillating up to about twice that (with the default max-retained of 1 the old modulo logic already trimmed on every completion, so default users see no difference). Savepoint and completed-point IDs stay in the same queue as before; that policy is unchanged and not part of this PR.

1.3 Performance / Side-Effect Analysis

  • Fresh jobs: no extra storage I/O.
  • Recovery: one directory listing per pipeline, O(files) IDs held as Long plus String in the deque.
  • Steady state with max-retained > 1: the trim now runs after every completion instead of every max-retained completions, and each call on the built-in plugins lists the job directory once.

1.4 Error Handling and Logging

Issue 1 (resolved from my last review): ZH retention section was untranslated. Fixed at c1c2013689: docs/zh/engines/zeta/checkpoint-storage.md now carries a translated "retention after recovery" section that matches the English text, including the external-plugin note.

Issue 2: the deletion call scales as O(files x ids) on both built-in plugins, which can matter for the first cleanup after recovery

  • Location: HdfsStorage.java:328-355 and LocalFileStorage.java:386-420 (checkpointIdList.contains(...) on a List<String> for every file), called from CheckpointCoordinator.java:1409-1417 inside synchronized completePendingCheckpoint.
  • Problem: this PR is the first change that can make the ID list large: after a failover with many leaked files, the first completion asks to delete all but max-retained of them in one call.
  • Risk: with N leaked files the single call does about N x N string comparisons on the coordinator's synchronized completion path. For a few hundred files this is negligible; for tens of thousands it would delay checkpoint completion for that pipeline. Low in realistic deployments, but it is exactly the scenario the PR targets.
  • Best improvement: build a HashSet of the IDs once inside each plugin's deleteCheckpoint(..., List<String>) (a two-line change), or delete in bounded chunks from the coordinator.
  • Severity: Low (non-blocking)
  • Raised by another reviewer: No

Issue 3: one malformed .ser name disables the whole restore

  • Location: LocalFileStorage.java:285-296, HdfsStorage.java:243-255
  • Problem: Long.parseLong(getCheckpointIdByFileName(...)) runs for every matching file inside one try; an unparsable name throws, the method returns a CheckpointStorageException, and the coordinator drops the entire enumeration (WARN only).
  • Risk: low, because only the plugin writes these names, but the failure mode is "retention silently reverts to the old leaking behavior".
  • Best improvement: skip an unparsable file individually with a WARN naming the file, and keep the other IDs.
  • Severity: Low (non-blocking)
  • Raised by another reviewer: No

Issue 4: older carry-over, bounded wait on the source job CLI

  • Location: CheckpointRestoreWithStopIT.java:~245 (sourceJobFuture.get() is unbounded; the file is not changed by the new commits).
  • Problem and risk: a process-exit regression would hold the fork until the outer CI timeout and hide the failing step.
  • Best improvement: get(2, TimeUnit.MINUTES) with a useful diagnostic, as the neighbouring scenarios already do.
  • Severity: Medium for test hygiene, non-blocking, and pre-existing rather than introduced here.
  • Raised by another reviewer: No

2. Code Quality Assessment

2.1 Coding Standards

Good. The new SPI method and the two overrides document the metadata-only contract, unsupported-versus-empty semantics and ordering; explicit imports; no wildcard imports.

2.2 Test Coverage and Test Stability

Rating: Risk present only because of the pre-existing unbounded wait in Issue 4; the new tests themselves are stable.

Test-to-risk mapping (each fails if the production logic is broken):

  • CheckpointManagerTest.testCheckpointRetentionAfterCoordinatorRecreation (both explicitRestore values): five persisted checkpoints, max 3, complete #6, expect [4,5,6]. It fails if the restore is removed (nothing would be trimmed and 1..6 would stay) or if the trim reverts to the modulo form. The false case exercises the persisted-status guard.
  • CheckpointManagerTest.testLegacyStorageKeepsPriorRetentionWithoutPayloadFallback: a legacy adapter throws AssertionError if payload enumeration is attempted, so it fails if someone adds a payload fallback; it also pins the "present versus unsupported" contract.
  • LocalFileStorageTest.testCheckpointIdsIncludeCorruptPayloadWithoutDeserialization and AbstractFileCheckPointTest.testMetadataIdsIncludeCorruptPayloadAndPreserveOtherPipelines: corrupt bytes with a valid name stay visible, another pipeline's file is untouched, a missing job directory yields an empty present list.
  • CheckpointStorageTest (fresh checkpoint-disabled batch job): the exact accessCounter == 1 assertion is preserved, now with a finally that restores the shared storage; nothing was weakened.
  • CheckpointRestoreWithStopIT: now drives five completions and asserts three retained files, which is stricter than before.

Small gaps (non-blocking, Issue 5): there is no test that a storage failure during enumeration still lets the coordinator construct, and none that a checkpoint-enabled fresh submission skips enumeration (only the checkpoint-disabled batch case is covered). The exact assertEquals(3, ...) in the IT could in theory see four files if a cancel lands between the store and the trim of one completion; a <= 3 plus >= 2 check would be immune, but I have not seen it fail.

Issue 5 (non-blocking, Low): add the two small tests above, or relax the IT equality. Raised by another reviewer: No.

CI for the current head: the fork Build run 40218041654 for exactly c1c201368963 completed with success, including unit-test on Java 11 and 17 for Ubuntu and Windows, engine-v2-it, engine-k8s-it and engine-resource-managers-it on both Java versions; the only non-success jobs are the intentionally skipped ones (updated-modules-integration-test-*, benchmarks, UI, edge-agent). The apache-side Build and Signal pull request update checks are also passing. The branch is ahead of dev by 6 and behind by 0, with no conflicts.

2.3 Documentation Updates

en and zh both describe the recovery guard, metadata-only enumeration, the external-plugin limitation and the corrected retention count, and they now agree with each other.

3. Architectural Soundness

3.1 Elegance

A precise fix at the owning layer: bookkeeping is restored where it was lost, and the storage SPI gets an explicit optional capability rather than a payload-heavy fallback.

3.2 Maintainability

Optional.empty() for unsupported versus a present empty list for no files is a clear contract; the trim loop no longer depends on the queue size being a multiple of max-retained.

3.3 Extensibility

External plugins can add the metadata-only method without touching restore or loading code.

3.4 Historical-Version Compatibility

Default SPI method keeps older plugins and mixed deployments working; no persisted format changes.

4. Issue Summary

Number Issue Location Severity
1 ZH retention section untranslated docs/zh/engines/zeta/checkpoint-storage.md Resolved at c1c2013689
2 Bulk delete is O(files x ids) via List.contains HdfsStorage.java:328-355, LocalFileStorage.java:386-420 Low (non-blocking)
3 One malformed .ser name drops the whole restore LocalFileStorage.java:285-296, HdfsStorage.java:243-255 Low (non-blocking)
4 Unbounded source-job CLI wait in the IT (pre-existing) CheckpointRestoreWithStopIT.java:~245 Medium test hygiene (non-blocking)
5 Missing enumeration-failure and fresh-streaming-job tests; strict equality in the IT CheckpointManagerTest, CheckpointRestoreWithStopIT.java Low (non-blocking)

5. Merge Recommendation

Conclusion: Ready to merge

Blockers (must fix): none. The earlier required item (zh translation) is fixed and the exact-head CI is green.

Recommended fixes (non-blocking): Issues 2 to 5, any of which can be a follow-up; Issue 2 is the one I would prefer to see soon because it is a two-line change.

Overall assessment: the fix addresses the real defect at the right layer, keeps fresh jobs free of extra I/O, preserves SPI and persisted-format compatibility, and is covered by tests that fail when the production logic is broken. Thank you both. As before, I have read permission only, so a write-capable maintainer still needs to give the effective approval and enqueue the merge.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Zeta] checkpoint max-retained is not enforced after coordinator recreation

4 participants