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

   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:
   
   1. An expired checkpoint is reported as `FAILED` with the 
`CHECKPOINT_EXPIRED` reason, never as `COMPLETED`, 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).
   2. The checkpoint error restarts **only** the failing pipeline: its restore 
count increases, the job stays `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.
   3. The sibling pipeline is untouched across that restore: no failed 
checkpoint, no pipeline restore, both pipelines are still reported by the job's 
checkpoint bookkeeping, and the sibling's completed-checkpoint 
count/history/ids survive instead of being cleared while it keeps completing 
new checkpoints.
   4. The job never leaves `RUNNING` while the expiring pipeline restarts 
inside its retry budget, and it still cancels cleanly back to `CANCELED`.
   
   ### Why this boundary has real regression risk
   
   `JobMaster#handleCheckpointError(pipelineId, neverRestore)` is given the 
failing pipeline id precisely so the error can be scoped, and 
`SubPlan#prepareRestorePipeline` additionally clears job-level metrics for one 
pipeline's location only. Both are one-line filters that fail silently when 
they regress:
   
   - an error handler that ignores `pipelineId` cancels 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;
   - restore bookkeeping that is not pipeline-scoped drops the sibling's 
checkpoint history/counters, which only shows up as missing recovery points 
later;
   - a restore that does not resume checkpointing leaves the restored pipeline 
running without checkpoints while the job reports `RUNNING`.
   
   ### Why existing coverage does not reach it
   
   - #13448 (`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 if `handleCheckpointError` drops the 
`pipelineId` filter.
   - `CheckpointCoordinatorFailoverIT` fails a barrier dispatch and expects the 
job to `FAIL`; `CheckpointRestoreWithStopIT` / `RecoveryLifecycleRestApiIT` 
recover from checkpoints that completed normally.
   - `RestApiIT#testCheckpointOverviewAndHistoryApi` fabricates a 
`CHECKPOINT_EXPIRED` entry by calling the monitor service directly; it never 
arms, expires or restores anything.
   - `ClusterFaultToleranceTwoPipelineIT` runs 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 = 2000` and 
`checkpoint.timeout = 3000`, in a single in-process master-and-worker node. The 
first pipeline ends in the test `InMemory` sink with `checkpoint_sleep = true`, 
whose `prepareCommit()` 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.times` is raised to 20 so the 
per-pipeline restore budget cannot run out while the assertions run, and 
`job.retry.interval.seconds` is lowered to 2 so a restore is observed quickly. 
The test identifies the expiring pipeline from the monitor overview (it is the 
only one with `failed > 0`) rather than relying on pipeline declaration order.
   
   `FakeSource` and the test `InMemory` sink are simple fixtures only; no 
Transform, SQL, connector or format behavior is exercised.
   
   ### Negative control
   
   Removing the `pipelineId` filter in `JobMaster#handleCheckpointError` (so 
every checkpoint error stops every pipeline) makes the test fail in 9.6 s at 
the scoping assertion:
   
   ```
   the healthy pipeline must not be restored by its sibling's expiry:
   {pipeline1: completed=0, failed=1, restored=0; pipeline2: completed=2, 
failed=0, restored=1}
   ==> expected: <0> but was: <1>
   ```
   
   The mutation was reverted and the pristine `seatunnel-engine-server` jar 
reinstalled (checksum `44bf32cfe5279c553a5db31b8ed735554b728e61`) 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?
   
   ```bash
   JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home \
   ./mvnw -o -q -pl 
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
     -DskipUT=true -DskipIT=false \
     -Dit.test=CheckpointExpiryPipelineScopeIT -DfailIfNoTests=false verify
   ```
   
   - Final version passes 4 consecutive runs on the pristine engine: 21.1 s / 
21.1 s / 21.1 s / 21.1 s.
   - `spotless:apply` passes for the module; `ImportClassCheckTest` passes; 
`git diff --check` is clean.
   - No production code changed, so no unit test is affected.
   
   ### Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add License 
Notice according
     [New License 
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new 
feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If necessary, please update `incompatible-changes.md` to describe the 
incompatibility caused by this PR.
   * [ ] If you are contributing the connector code, please check that the 
following files are updated:
     1. Update 
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
 and add new connector information in it
     2. Update the pom file of 
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in 
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
   


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