SEZ9 opened a new pull request, #13154:
URL: https://github.com/apache/seatunnel/pull/13154
### Purpose of this pull request
Closes #13153.
A pipeline that restarts repeatedly reports that it is restarting but not
why. `SubPlan.errorByPhysicalVertex` holds the current attempt only, and
`initStateFuture` replaces it on every restore:
```java
// reset errorByPhysicalVertex when restore pipeline
errorByPhysicalVertex = new AtomicReference<>();
```
So by the time anyone looks at a crash-looping pipeline, every earlier
reason is gone. The diagnostics block publishes `restoreCount` and
`maxRestoreCount`, which is enough to **detect** a crash loop — and
`--diagnose` (#12631, #12688) does — but not enough to **act** on one. The
first question is what is failing, and the answer existed only in the logs of a
run that has already been replaced.
The causes are now retained and published as `restoreCauses` on each
pipeline, oldest first.
Capture happens in `prepareRestorePipeline`, inside the existing
`restoreLock`, after the restore counter is incremented and before `reset()` —
`initStateFuture` clears the reference later, so this is the last point at
which the value still describes the run that ended.
**Bounded twice over.** A restore only happens while `pipelineRestoreNum <
pipelineMaxRestoreNum`, which `job.retry.times` sets and defaults to 3, and the
list is capped at 16 regardless in case that option is configured high. Each
entry is truncated to 2048 characters.
**No new configuration option.** The existing retry limit already bounds
this. Adding one would cost a `ServerConfigOptions` entry, a branch in
`YamlSeaTunnelDomConfigProcessor` (where parsing is explicit per key, so
omitting it silently ignores the option) and another documented knob — for a
list that holds at most sixteen truncated strings and presents the user with no
decision.
A restore with **no** recorded error is listed with a placeholder rather
than omitted. "Restarted for an unknown reason" is a different and more
alarming state than "restarted because the sink refused the connection", and
dropping it would make the two look the same.
### Does this PR introduce _any_ user-facing change?
Yes, additively: a new `restoreCauses` array on each pipeline in the
`diagnostics` block of `GET /job-info/{jobId}`.
```json
"pipelines": [
{
"pipelineId": 1,
"pipelineStatus": "RUNNING",
"restoreCount": 7,
"maxRestoreCount": 100,
"restoreCauses": [
"restore 6: ... ErrorCode:[JDBC-05] ... Connection refused",
"restore 7: ... ErrorCode:[JDBC-05] ... Connection refused"
],
"stateTimestamps": { ... }
}
]
```
No existing field changes name, type or meaning, and a client that ignores
unknown fields is unaffected, so no `incompatible-changes.md` entry is needed.
Clients talking to an older server simply will not see the field and should
treat it as optional. Documented in EN and ZH `rest-api-v2.md`.
### How was this patch tested?
Four tests in `SubPlanTest`, reusing its existing `newSubPlan` factory:
causes are retained with the attempt number and the message; a restore with a
null or blank error gets the placeholder; the list is capped at 16 with the
oldest dropped and long entries truncated; and the getter returns a copy so a
caller cannot clear the retained list.
They exercise the retention directly rather than driving a real restore,
which would need a live `JobMaster` and checkpoint manager and would end up
testing those instead.
**I could not compile or run these locally** — Maven on this machine cannot
reach `repo.maven.apache.org` (`flatten-maven-plugin` and `guava` both fail to
resolve, offline and online), so I am relying on CI for compilation and test
execution. I would rather say that than imply a green local build. The changes
are small and self-contained, but a reviewer should treat the CI result as the
first real verification. If CI finds a problem I will fix it promptly.
What I did verify by hand: the capture point is inside `synchronized
(restoreLock)` so retention is serialised; `reset()` does not touch
`errorByPhysicalVertex`, so the value is still present at the capture point;
the failing vertex sets it via `compareAndSet` before the pipeline reaches the
restore decision; `ConcurrentLinkedQueue.size()` is O(n) but n is capped at 16;
and `getRestoreCauses()` copies.
--
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]