Repository navigation
[Test][Zeta] Guard checkpoint expiry against restarting a sibling pipeline - #13541
zhangshenghang wants to merge 1 commit into
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
What problem this PR solves
If one pipeline's checkpoint expires in a two-pipeline job, only that pipeline should restart. The other pipeline should continue checkpointing, and the job should remain RUNNING. Using two real pipelines in one job is the right location to test that isolation and that the original expiry ID does not return.
Findings
-
High, blocks merge. Pin the failed checkpoint record by ID instead of re-reading
latestFailed.CheckpointExpiryPipelineScopeIT.java:155–174stores the current failed ID, then:182–200re-reads the overview and requires its newest failed ID to be the same. The fixture repeatedly expires checkpoints. If a second failure completes between those reads, the test reports a failure even though both records are correct. Retain the actualCheckpointInfofrom the first successful poll, or use the captured pipeline and checkpoint IDs to find the matching history entry. Use that record for assertions about the failure reason and the successor ID. This is a test observation race and does not require production changes. -
Medium, test stability. Give the healthy pipeline independent timing headroom. The fixture sets a three-second checkpoint timeout for both pipelines at
stream_two_pipeline_expiring_checkpoint.conf:38–41, with a five-second prepareCommit delay in the failing sink.CheckpointCoordinator.java:1075–1106times out any barrier with missing task acknowledgements, regardless of which sink caused the delay. A sufficiently loaded E2E runner can therefore expire the nominally healthy barrier and make the test fail for scheduler latency. Use a controllable hold in only the failing sink so the shared timeout can be long enough for the healthy pipeline. The test can explicitly release the held sink after observing the expected expiry and release it in teardown. -
Medium, coverage gap. Check stored state when asserting that the expired ID could never be restored.
CheckpointExpiryPipelineScopeIT.java:203–214checks the monitor count and completed history only. A future error path that writes a checkpoint and then reports it as FAILED would keep these assertions green. Read the persisted checkpoint list for the failing pipeline and require the expired ID to be absent. The history checks should remain because they verify the operator-facing status independently.
Call path and merge readiness
The slow sink prevents the barrier acknowledgement. The coordinator calls the expiry error path for that pipeline, CheckpointManager records a pipeline restore, and the healthy branch continues through its own coordinator and checkpoint history. The job-wide status and sibling history assertions would catch a restore that spills into the healthy pipeline. The test configuration and E2E class do not affect product configuration, APIs, or persisted formats.
Reviewed 69f047f88048592d8d09fa2b5a6a6ce116e29e80 against merge base ee0fb0d72f67edbcd6caf08360fd354fa68e002f on 2026-11-28 at 07:11 EST (UTC−05:00). I checked the complete diff, discussion, fixture, expiry and restore paths, and E2E discovery using git diff, git diff --check (passed), git show, git grep, and GitHub APIs. No local builds or tests were run. Current-head Build is queued and GitHub review is required. Please stabilize the expiry evidence before merging.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for covering checkpoint failure isolation across two real pipelines. I reviewed the full fixture/test and actual timeout-to-restore flow. No source-level merge blocker found; the two suggestions below make the observation and stated coverage more reliable.
What problem does this PR solve?
User pain: A checkpoint expiry in one pipeline must not restart/erase the state of an independent healthy sibling or take down the whole job while retry budget remains.
Change: Add a two-pipeline streaming fixture with one deliberately delayed sink and inspect real per-pipeline failure, restore, history and progress.
In one sentence: A slow failing branch should recover locally while its fast sibling keeps checkpointing.
1. Code changes
1.1 Core logic
Complete runtime path:
One in-process master/worker -> two independent source-to-InMemory pipelines
-> periodic checkpoints every2s / deadline3s
-> expiring sink prepareCommit sleeps5s; sibling has no injected delay
-> CheckpointCoordinator timeout -> handleCoordinatorError(CHECKPOINT_EXPIRED):1101
-> pending abort -> monitor.onCheckpointFailed(job,pipeline,...):1293
-> failed pipeline restore -> monitor.onPipelineRestored increments that pipeline only
-> SubPlan retry/release/reapply -> new checkpoint IDs
Test -> failed reason/zero completed on expiring branch, unique recorded IDs
-> sibling no failure/restore, preserved history/count and later completed checkpoint
-> job remains RUNNING -> cancellation CANCELED
Key findings and correctness:
Both complete new files and the real coordinator/monitor/restore path were reviewed. The test discovers the failing pipeline from failed counters, checks the expiry reason, rejects a partially completed slow checkpoint, and separately requires real restore count and later checkpoint IDs. The sibling's count/history/continued progress complement the job-level RUNNING assertion, so a whole-job restart cannot be hidden by eventual recovery. Source split pacing keeps the finite source active for the normal test interval; STREAMING also leaves it open when exhausted. The implementation does not change production timeout/retry/serialization behavior. There are two observation limitations: the expiring snapshot is reread after its ID was captured, and phase5's atMost is not a continuous stability window (Issues1/2). The actual checks establish at least one restore, not the two-cycle guarantee stated in the class commentary.
Before:
After:
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.seatunnel.engine.e2e;
import org.apache.seatunnel.common.config.Common;
import org.apache.seatunnel.common.config.DeployMode;
import org.apache.seatunnel.engine.client.SeaTunnelClient;
import org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment;
import org.apache.seatunnel.engine.client.job.ClientJobProxy;
import org.apache.seatunnel.engine.common.config.ConfigProvider;
import org.apache.seatunnel.engine.common.config.JobConfig;
import org.apache.seatunnel.engine.common.config.SeaTunnelConfig;
import org.apache.seatunnel.engine.common.job.JobStatus;
import org.apache.seatunnel.engine.core.checkpoint.CheckpointHistoryEntry;
import org.apache.seatunnel.engine.core.checkpoint.CheckpointInfo;
import org.apache.seatunnel.engine.core.checkpoint.CheckpointOverview;
import org.apache.seatunnel.engine.core.checkpoint.CheckpointStatus;
import org.apache.seatunnel.engine.core.checkpoint.PipelineCheckpointOverview;
import org.apache.seatunnel.engine.server.CoordinatorService;
import org.apache.seatunnel.engine.server.SeaTunnelServer;
import org.apache.seatunnel.engine.server.SeaTunnelServerStarter;
import org.apache.seatunnel.engine.server.checkpoint.monitor.CheckpointMonitorService;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.instance.impl.HazelcastInstanceImpl;
import com.hazelcast.spi.impl.NodeEngineImpl;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
1.2 Compatibility
Fully compatible: E2E/test resources only. No production API/SPI, configuration default, protocol, row/state/checkpoint layout or historical engine behavior changes. No migration is required.
1.3 Performance and side effects
Test-only two pipelines, short checkpoint scheduling, repeated slow-sink work and small overview/history snapshots. The injected five-second delay and polling add CI work, not production cost. Retry budget20 is finite and could be consumed in an unusually prolonged run; no unlimited lifetime is promised. No production memory buffer, global lock, retry/idempotence or network contract changes.
1.4 Errors, logging, and findings
Issue 1: Keep the expiry ID and asserted overview from one accepted snapshot
- Location:
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointExpiryPipelineScopeIT.java:184. - Description and risk: The Awaitility predicate captures latestFailed.id, then the test independently rereads the overview and asserts latestFailed still equals that ID. The slow branch continues to expire/restart, so a delayed test thread can see the next legitimate failure in that second read and fail despite correct pipeline isolation. The assertion is therefore timing-sensitive rather than an immutable-history check.
- Best improvement: Capture and retain the entire accepted overview/snapshot together with its IDs, or locate the captured checkpoint in retained history instead of requiring it still be latest. Keep later progress observations separate and bounded.
- Responsibility and trade-off: The real multi-pipeline engine E2E is the right boundary for failure isolation; a monitor-only injected record would miss coordinator/pipeline recovery. Keep improvements in observation/fixture synchronization and avoid changing engine timeout semantics to make this test pass.
- Severity: Medium; blocking: false.
- Previously raised by another reviewer: No, unless explicitly attributed above.
Issue 2: Assert the claimed continuing stability/restore window explicitly
- Location:
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointExpiryPipelineScopeIT.java:377. - Description and risk: The phase uses atMost(15s) without during, so it exits at the first successful sample; it does not observe continued clean sibling state while further restore cycles run. The class also claims two cycles, while the only restore-count threshold is >=1. This is a coverage-strengthening issue, not a demonstrated engine regression.
- Best improvement: Use a bounded during window with the existing predicates and explicitly require the desired restore-count progression, or narrow the stated contract to the single observed cycle. Prefer a test-owned slow-branch gate with a comfortable healthy timeout to avoid making runner latency the isolation oracle; do not simply describe atMost as a sustained window.
- Responsibility and trade-off: The real multi-pipeline engine E2E is the right boundary for failure isolation; a monitor-only injected record would miss coordinator/pipeline recovery. Keep improvements in observation/fixture synchronization and avoid changing engine timeout semantics to make this test pass.
- Severity: Medium; blocking: false.
- Previously raised by another reviewer: No, unless explicitly attributed above.
Community input: no independent technical finding or maintainer approval/change request was present in the collected discussion.
2. Code quality
2.1 Conventions
Reviewed all changed files for license, imports, naming, core-method and state-field comments. See the numbered findings for the required changes.
2.2 Test coverage and stability
Stability rating: Risk present. Risk present, non-blocking: real failed/healthy checkpoint oracles and bounded polls are useful, but a later snapshot can race another expiry (Issue1), and the final claimed window returns on its first success (Issue2). The healthy branch shares a short three-second checkpoint timeout, so under runner pressure a genuine scheduling timeout can also fail its zero-failure assertion; a controlled slow-branch gate would isolate injection more strongly than widening arbitrary sleeps. Sorted completed IDs/uniqueness checks avoid HashMap order assumptions. HTTP is disabled, members/client are owned, and no new external container/port is added. Synchronous final cancel/close calls are still outside the polling deadlines, so no strict overall teardown-time guarantee is claimed. Current-head fork Build is queued with no failed job in the inspected manifest. No local job/test or measured flake rate is claimed.
2.3 Documentation
No user-facing EN/ZH guide changes are necessary. The substantial class/fixture comments explain the intended failure isolation; align their two-cycle/stability claims with the actual assertions. All new files carry ASF headers.
3. Architecture
3.1 Change location
The real multi-pipeline engine E2E is the right boundary for failure isolation; a monitor-only injected record would miss coordinator/pipeline recovery. Keep improvements in observation/fixture synchronization and avoid changing engine timeout semantics to make this test pass.
3.2 Maintainability
Keep the behavior, lifecycle ownership, and failure contract together. The real multi-pipeline engine E2E is the right boundary for failure isolation; a monitor-only injected record would miss coordinator/pipeline recovery. Keep improvements in observation/fixture synchronization and avoid changing engine timeout semantics to make this test pass.
3.3 Extensibility
Prefer the existing component boundary and tests over unrelated shared abstractions.
3.4 Upgrade impact
Fully compatible: E2E/test resources only. No production API/SPI, configuration default, protocol, row/state/checkpoint layout or historical engine behavior changes. No migration is required.
4. Findings summary
Completeness check: All changed files and affected entry/failure paths were reviewed; configuration/serialization compatibility, test failure capability and stability, documentation/examples, change ownership, and current CI/conflict/review gates are covered above. No unreviewed source scope is claimed complete.
| # | Finding | Location | Severity |
|---|---|---|---|
| 1 | Keep the expiry ID and asserted overview from one accepted snapshot | seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointExpiryPipelineScopeIT.java:184 |
Medium |
| 2 | Assert the claimed continuing stability/restore window explicitly | seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/CheckpointExpiryPipelineScopeIT.java:377 |
Medium |
5. Merge recommendation
Can merge once the recorded CI and repository gates are satisfied
Blocking items: No source blocker. Current-head CI and write-capable maintainer review remain independent requirements.
Non-blocking suggestions: Issue 1: Keep the expiry ID and asserted overview from one accepted snapshot; Issue 2: Assert the claimed continuing stability/restore window explicitly
Overall: the reviewed source path is coherent; no runtime acceptance is claimed beyond the actual CI result. Daniel has READ permission, so this COMMENT cannot dismiss historical requested changes or satisfy a write-capable maintainer approval gate.
CI and repository state: Signal pull request update: SUCCESS; Build: QUEUED; Build: queued. GitHub reports BLOCKED / REVIEW_REQUIRED.
Verification: Reviewed all changed files and the referenced call sites at 69f047f88048592d8d09fa2b5a6a6ce116e29e80 against merge base ee0fb0d72f67edbcd6caf08360fd354fa68e002f. git diff --check passed. I did not build, run tests, or execute SeaTunnel locally.
Review time: 2026-11-28T07:40:35.337189-05:00
Local evidence: git fetch obtained head 69f047f88048592d8d09fa2b5a6a6ce116e29e80; git merge-base returned ee0fb0d72f67edbcd6caf08360fd354fa68e002f; git diff --stat reports 2 files changed, 641 insertions(+). git show and source searches were used for the entry points above. No local build, unit test, E2E, Docker run or service startup was executed.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for your patience. The CI fact in my earlier review has changed: Apache Build is now successful, matching the completed successful exact-head fork Build. The preceding complete source review had no remaining source blocker; its only outstanding technical blocker was CI. CI has now recovered, so I am changing my technical review to APPROVED.
5. Merge recommendation
Conclusion: Can merge from Daniel's technical perspective
Blocking source/CI items: None from the existing complete review and the current successful Build. Effective independent write-capable maintainer approval, protected-branch review and any required historical-review dismissal remain separate repository gates.
Non-blocking suggestions: Those in the existing complete source review remain optional; this CI update introduces no new source finding or unrelated implementation request.
Daniel has READ permission. This APPROVED review records Daniel's technical conclusion; it does not supply write-level maintainer approval or establish that an older changes-requested record was dismissed. The sidebar rendering and its cause have not been visually established.
Unchanged head 69f047f88048592d8d09fa2b5a6a6ce116e29e80; base dev; compare diverged, ahead 1 / behind 19. Drift is recorded independently and does not request a sync. This is a CI-fact update, not another full source review. No local build, tests or SeaTunnel runtime was executed.
davidzollo
left a comment
There was a problem hiding this comment.
+1, approved. Thanks for strengthening the SeaTunnel test coverage. The test checks that checkpoint expiry does not spuriously restart a sibling pipeline.
The changes are confined to test code and fixtures. The required Build and the affected tests passed on 69f047f88048. Source review
Yes, I am contributing to Apache SeaTunnel. This change only adds regression coverage to the Zeta engine E2E suite; no production code is modified.
Purpose of this pull request
Adds
CheckpointExpiryPipelineScopeIT#testCheckpointExpiryRestartsOnlyItsOwnPipeline, an end-to-end test for the scope of a checkpoint failure inside a multi-pipeline Zeta job: when one pipeline's checkpoint expires, only that pipeline may be restarted, and the sibling pipeline, its checkpoint chain and the job itself must be left untouched.Contract under test:
FAILEDwith theCHECKPOINT_EXPIREDreason, never asCOMPLETED, and the expiring pipeline owns no completed checkpoint while its only checkpoint is stuck (a checkpoint that expired must not be persisted as a successful one).RUNNING, and the restored run resumes checkpointing on a new id (> expiredId, never reused), so the persisted checkpoint-id counter survives a checkpoint-error restore.RUNNINGwhile the expiring pipeline restarts inside its retry budget, and it still cancels cleanly back toCANCELED.Why this boundary has real regression risk
JobMaster#handleCheckpointError(pipelineId, neverRestore)is given the failing pipeline id precisely so the error can be scoped, andSubPlan#prepareRestorePipelineadditionally clears job-level metrics for one pipeline's location only. Both are one-line filters that fail silently when they regress:pipelineIdcancels the healthy sibling's tasks, aborts its in-flight checkpoint and restores it — the job still converges, the failing pipeline still restores, and no task ever reports an error, so a single-pipeline test cannot see it;RUNNING.Why existing coverage does not reach it
CheckpointTimeoutPipelineRestoreIT) pins the single-pipeline timeout → restore → resume chain; with a single pipeline there is no sibling to leak into, and the test still passes ifhandleCheckpointErrordrops thepipelineIdfilter.CheckpointCoordinatorFailoverITfails a barrier dispatch and expects the job toFAIL;CheckpointRestoreWithStopIT/RecoveryLifecycleRestApiITrecover from checkpoints that completed normally.RestApiIT#testCheckpointOverviewAndHistoryApifabricates aCHECKPOINT_EXPIREDentry by calling the monitor service directly; it never arms, expires or restores anything.ClusterFaultToleranceTwoPipelineITruns two pipelines but never lets one of them expire a checkpoint while the other keeps checkpointing.How the test pins the window
The job runs two independent pipelines with
checkpoint.interval = 2000andcheckpoint.timeout = 3000, in a single in-process master-and-worker node. The first pipeline ends in the testInMemorysink withcheckpoint_sleep = true, whoseprepareCommit()sleeps 5 s, so every checkpoint of that pipeline is guaranteed to expire; the second pipeline's sink is fast and completes checkpoints in milliseconds.job.retry.timesis raised to 20 so the per-pipeline restore budget cannot run out while the assertions run, andjob.retry.interval.secondsis lowered to 2 so a restore is observed quickly. The test identifies the expiring pipeline from the monitor overview (it is the only one withfailed > 0) rather than relying on pipeline declaration order.FakeSourceand the testInMemorysink are simple fixtures only; no Transform, SQL, connector or format behavior is exercised.Negative control
Removing the
pipelineIdfilter inJobMaster#handleCheckpointError(so every checkpoint error stops every pipeline) makes the test fail in 9.6 s at the scoping assertion:The mutation was reverted and the pristine
seatunnel-engine-serverjar reinstalled (checksum44bf32cfe5279c553a5db31b8ed735554b728e61) before the final runs.Does this PR introduce any user-facing change?
No. This is test-only coverage; no engine behavior, configuration, or API is changed.
How was this patch tested?
spotless:applypasses for the module;ImportClassCheckTestpasses;git diff --checkis clean.Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR.