zhangshenghang opened a new pull request, #13463:
URL: https://github.com/apache/seatunnel/pull/13463
Yes, I am contributing this change to Apache SeaTunnel.
### Purpose of this pull request
This is a test-only change. It adds one Zeta engine E2E that guards the
pipeline-restore diagnostics contract introduced by #13154: after a pipeline
really fails and is restored from a checkpoint, `/job-info` must explain that
restore through `diagnostics.pipelines[].restoreCauses`, not only count it in
`restoreCount`.
**Why this is a boundary with real regression risk.**
`SubPlan#restoreCauses` exists because `errorByPhysicalVertex` only describes
the current attempt and is replaced when the next attempt is initialized. The
failed run's text therefore has to be captured while it is still visible, and
the retained list has to survive the successful retry and be readable from
every member. #13154 added unit tests for the retention method and for the JSON
rendering separately, but nothing exercises the whole path: a task fails, the
pipeline restores from a checkpoint, the job keeps running, and the REST
response explains why. Two easy regressions are currently invisible to CI:
capturing the cause after the failed attempt's error is cleared (every entry
silently becomes `no error was recorded for this run`), and
dropping/duplicating a cause while the restored pipeline makes progress.
**What the test does.** It runs a real streaming job on the existing
two-member in-JVM cluster used by `RestApiIT`. The fixture
(`restore-cause/stream_checkpointable_to_inmemory_fail_once_template.conf`)
emits records slowly enough that several periodic checkpoints complete, and the
InMemory sink fixture fails exactly one configured `write` (record 600) with a
distinctive message. The failing writer creates a marker file *before*
throwing, so the restored attempt cannot fail the same way again; the marker is
a file rather than static state because a restore may load the sink with a
fresh classloader. The test then asserts:
* every restore has exactly one retained cause, oldest first, numbered
`restore 1:`, `restore 2:` … and `totalPipelineRestoreCount` matches the single
pipeline's `restoreCount`;
* the first cause contains the sink's own failure text and is not the `no
error was recorded` placeholder — this is what catches a lost capture;
* while the restored pipeline completes further checkpoints, `restoreCount`
and the cause list stay byte-for-byte unchanged;
* the same restore count and cause list are served when the request lands on
the other member (master fan-out path).
No engine, connector, or format logic is modified: the only non-test-class
change is a new failure-injection option on the E2E `InMemory` sink fixture,
which is a no-op unless both new options are set, so every existing test using
that sink keeps its behavior.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Formatting:
```
./mvnw -o -pl
seatunnel-e2e/seatunnel-e2e-common,seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base
spotless:check
```
passed.
New E2E executed locally against a clean `dev`:
```
./mvnw -o -pl
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base \
-DskipUT=true -DskipIT=false \
-Dit.test='RestApiIT#testJobDiagnosticsExplainPipelineRestore' \
-DfailIfNoTests=false verify
```
`Tests run: 1, Failures: 0, Errors: 0, Skipped: 0` (about 31 s).
The test was also verified to fail for the regression it targets: with
`SubPlan` temporarily changed to retain `null` instead of the failed attempt's
error, it fails with
```
The first cause must be the sink failure that triggered the restore, not a
placeholder,
but was: restore 1: no error was recorded for this run
```
The probe was reverted, the module rebuilt, and the test passes again.
### 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)
— not applicable
* [ ] If necessary, please update the documentation to describe the new
feature — not applicable, test-only
* [ ] If necessary, please update `incompatible-changes.md` — not applicable
* [ ] Connector contribution checklist — not applicable
--
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]