You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "davidzollo (via GitHub)" <gi...@apache.org> on 2026/07/11 10:55:43 UTC
[I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
davidzollo opened a new issue, #11406:
URL: https://github.com/apache/seatunnel/issues/11406
## Background
Long-running SeaTunnel jobs depend on checkpointed or restored state, but the community still lacks a clear shared contract for connector state versioning and restore compatibility.
Over time, this becomes a serious upgrade and recoverability risk.
## Problem to solve
We need a clearer answer to these questions:
- what state version does a connector produce?
- what older state versions can it still read?
- what should happen when restore compatibility is broken?
- how should maintainers communicate state-breaking changes?
Without an explicit contract, upgrades can fail in ways that are hard for operators to predict before they happen.
## Proposal
Define a connector state versioning and restore compatibility contract.
Suggested first-delivery scope:
- define minimal state version metadata
- define pre-restore compatibility checks
- define standard failure behavior when compatibility is not satisfied
- define how connector-specific migration hooks may fit later
## Why this should be discussion-first
This topic affects:
- long-running streaming and CDC jobs
- restore behavior after upgrade or failover
- compatibility expectations for connector maintainers
- release and upgrade communication
This is a long-term contract topic, not only an isolated implementation feature.
## Non-goals for v1
- do not guarantee compatibility with every historical state version forever
- do not introduce silent fallback when compatibility is unknown
- do not require a full migration framework on day one
## Suggested validation
- validate successful restore for compatible state versions
- validate explicit blocking behavior for incompatible state versions
- validate that upgrade notes can point to a clear compatibility outcome
## Acceptance criteria
- minimal state version metadata is defined
- restore compatibility can be checked before normal restore proceeds
- incompatible restore paths fail with explicit feedback
- the community agrees on the minimum compatibility promise expected from connectors
## Related issues
- #10926
- #11020
--
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: commits-unsubscribe@seatunnel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org>.
SEPURI-SAI-KRISHNA commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-6415615724
@DanielLeens your last point asked for the missing piece: a concrete incompatibility example and the exact error shape. Measured on JDK 17 against current `dev`.
**The example.** `ChainedMapTransform` gained a field in #12804 with no pinned UID. Writing state before that commit and reading it after gives:
```
java.io.InvalidClassException: ...ChainedMapTransform; local class incompatible:
stream classdesc serialVersionUID = 8769738606872706499,
local class serialVersionUID = 4659105814088680487
```
**Why this argues for the contract.** That error is the *good* outcome. If a maintainer pins the old UID, which is what #12938 did for a sibling class, deserialization succeeds and the field restores as `null`. The job then fails with a `NullPointerException` on the first row, and the schema-change path fails too. So one root cause gives either a loud startup error or a silent restore then a data-path crash, depending on the remedy picked. That is the "inconsistent restore failures across connectors" you warned about, and release notes do not fix it.
This also confirms @det101's point by measurement: the UID tracks field layout, not semantics. Marking that field `transient` moves it back to `8769738606872706499` with no behaviour change.
**One input not yet raised here.** There are two serialization worlds, and a v1 contract covering one leaves the other silent:
- Connector split and enumerator state: `SeaTunnelSource` defaults both serializers to `DefaultSerializer`, i.e. `SerializationUtils`, plain Java serialization. Exactly one connector supplies its own, Firebase. So the UID governs restore for almost every connector.
- Engine checkpoint storage: `AbstractCheckpointStorage` hard-codes `new ProtoStuffSerializer()`. Protostuff never reads the UID, and a field added later is skipped and returns its default, as the repo's own `WALReaderAndWriterTest` notes.
So the Java path fails loudly on a UID change while protostuff accepts the old bytes and silently defaults the new field. Opposite failure modes, same logical event.
I have the probes, the before and after streams, and a measured fix shape for the Java-serialization side, so I can take a slice of this forward rather than only describe it. If the four points are close to settled, say which slice is most useful and I will open a PR. Otherwise I can start from a focused issue so this discussion is not blocked.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "det101 (via GitHub)" <gi...@apache.org>.
det101 commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-5030631419
Thanks — that framing helps. I’m fine keeping the serializer/envelope layout out of the v1 contract. Let’s try to align on the four points first:
1. Where producer version metadata lives
The writer records a business state version alongside the connector state at checkpoint/save time. Exact storage shape (header, sidecar metadata, engine wrapper, etc.) can stay an implementation choice; the contract only requires that a producer version is available before restore proceeds.
2. Where the reader declares its readable range
Each connector (or state owner) declares which versions it can still restore — e.g. current version plus an explicit readable range / set. This declaration is owned by the reader side, not inferred from Java serialVersionUID.
3. Who compares before restore continues
Compatibility is checked before normal restore proceeds. Prefer a shared restore entry point (engine / common restore path) that compares producer version vs reader-declared readable versions, so operators get a consistent outcome across connectors. Connector-specific logic may supply the readable range, but should not silently decide to continue after a mismatch.
4. What operators see on incompatibility
On mismatch: fail early with an explicit error that names the connector (or state owner), produced version, and readable versions, and points to upgrade / migration guidance. No silent fallback when compatibility is unknown or broken.
If this matches the minimal compatibility promise you had in mind, we can treat migration hooks and any concrete wire format (e.g. envelope) as additive follow-ups rather than part of the first contract.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-4956719776
Thanks, this is a useful refinement.
I agree with the ownership split: the writer should record which state version it produced, and the reader should declare which version range it can still consume. The important v1 behavior is then deterministic: compare them before normal restore proceeds, and fail early with a clear message when they do not match.
I would keep one boundary explicit in this discussion, though: the contract should standardize the compatibility outcome, but it does not necessarily need to hard-code one serializer layout as the only valid implementation shape. An envelope like `magic + version + payload` is a reasonable option, and treating pre-envelope checkpoints as a legacy version can also be practical, but those feel more like implementation choices unless we prove every state path needs the same wire shape.
For the issue itself, the minimum points worth making explicit are still:
1. where the producer version metadata lives
2. where the reader declares its readable range
3. which component performs the comparison before restore continues
4. what exact error and upgrade guidance the operator sees on incompatibility
If we can align on those four points first, later migration hooks or serializer-specific details can remain additive instead of blocking the first compatibility contract.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "det101 (via GitHub)" <gi...@apache.org>.
det101 commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-4954095191
I think the version contract should be owned by both sides:
- the writer records which version it produced
- the reader declares which versions it can still read
- if they don’t match, fail early and clearly — no silent fallback
For placement, I’d put a small envelope **outside** the existing `Serializer`:
```text
magic + version + payload
```
Old checkpoints won’t have this envelope. On read, treat them as legacy version 0. Whether 0 is still accepted is up to the reader. During the transition we can keep reading 0; when we intentionally break compatibility, drop 0 and fail with a clear upgrade note.
serialVersionUID can stay as a Java serialization safety net, but it shouldn’t be our business state version.
Happy to help sketch the API / error messages if this direction sounds right.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "DanielLeens (via GitHub) via commits" <co...@seatunnel.apache.org>.
DanielLeens commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-6595080503
@SEPURI-SAI-KRISHNA thanks, this is exactly the missing piece: a measured failure instead of a hypothetical one. I checked the paths on current `dev` and want to refine one point before we pick a slice.
**The two worlds are layered, not parallel.** `AbstractCheckpointStorage` does use `ProtoStuffSerializer`, but what it stores for connectors is `ActionSubtaskState.state`, a `List<byte[]>`. Those bytes are opaque to protostuff; they are produced and later read by the connector's own serializer (`DefaultSerializer` by default via `SeaTunnelSource#getSplitSerializer` / `#getEnumeratorStateSerializer`; Firebase is the only source overriding both). So there are really three surfaces:
1. **Connector-owned state** inside those byte arrays (split, enumerator, sink writer/commit state).
2. **Engine-owned checkpoint fields** encoded by protostuff (the silent-default case you describe). #11962 is already proposing an explicit engine wire version for savepoints.
3. **Persisted job plan objects**, such as `ChainedMapTransform`. It is not checkpoint state; it lives in the serialized logical DAG. Your #12804 / #12938 / #12990 example is real, but it belongs to this surface.
**Proposed v1 scope:** surface 1 only. Surfaces 2 and 3 stay with #11962 and the upgrade-compatibility STIP (#11897), and get cross-referenced, not duplicated.
**Where the check happens:** the engine call sites that turn those bytes back into objects. Today they wrap failures with `sneaky(...)` and rethrow the raw cause, e.g. `SourceSplitEnumeratorTask#restoreState`, `RestoredSplitOperation`, `SinkFlowLifeCycle` and `SinkAggregatedCommitterTask`. So the operator currently sees a bare `InvalidClassException` with no job, action or checkpoint context.
**Proposed error shape (one format for every connector):**
```
Cannot restore state of action '<action name>' (job <id>, pipeline <n>, checkpoint <id>):
state produced by version <v|unknown> is not readable by this connector (readable: <range>).
See the upgrade notes for <connector>. Cause: <original exception>
```
**Most useful first slice:** a PR that adds only this wrapping at those call sites, with no change to the bytes on disk. It is fully backward compatible, gives operators a consistent message right away, and is the hook where the version comparison plugs in later. Your before/after `InvalidClassException` stream is a good fixture for its test.
If that sounds right, please open that focused PR. In parallel I would write the four agreed points plus this scope and error shape into a short STIP draft and start a dev@ thread, because the producer/readable version metadata itself touches the `Serializer` SPI.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "SEPURI-SAI-KRISHNA (via GitHub) via commits" <co...@seatunnel.apache.org>.
SEPURI-SAI-KRISHNA commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-6595361528
@DanielLeens thanks, agreed on the three surfaces and on keeping v1 to surface 1, with #11962 and #11897 covering the other two. I will open the focused PR you describe: wrap the restore of connector-owned state at `SourceSplitEnumeratorTask#restoreState`, `RestoredSplitOperation`, `SinkFlowLifeCycle#restoreState` and `SinkAggregatedCommitterTask#restoreState` in that one message format, keep the original exception as the cause, and change nothing in the bytes on disk. The test will restore the before and after `InvalidClassException` stream through those paths and assert the message.
One point to settle first. On current `dev` the checkpoint id does not reach these call sites. `CheckpointCoordinator` knows it (it logs the id when it loads the latest completed checkpoint), but `NotifyTaskRestoreOperation` carries only the task location and the `ActionSubtaskState` list, and `RestoredSplitOperation` carries only the split bytes. Job id, pipeline id and the action are available from `TaskLocation` and `ActionStateKey`. The task runs `restoreState` asynchronously and reports a failure back as a `CheckpointErrorReportOperation` holding only the error message, and `CheckpointCoordinator#reportCheckpointErrorFromTask` then fails the pipeline with `CHECKPOINT_INSIDE_ERROR`. Two ways to include the checkpoint id:
1. Add it to `NotifyTaskRestoreOperation` and pass it down to `restoreState`. That changes the operation's wire format and the `Stateful#restoreState` signature, and still leaves `RestoredSplitOperation` without it.
2. Keep the task side message without the checkpoint id, and have the coordinator add the id of the checkpoint it restored from when it turns that report into the pipeline failure during restore.
I lean to 2 because it keeps the slice free of wire format and interface changes. Until the version metadata exists, the message would say the producing version is unknown and leave out the readable range. Does that match what you had in mind?
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-4949417095
This is a worthwhile design topic. The real problem is not only “can restore fail”, but whether operators and connector maintainers can know the compatibility outcome before a restore gets far enough to be dangerous or confusing.
For v1, I would keep the contract intentionally small and make two boundaries explicit:
1. connector-owned state version metadata versus broader semantic compatibility claims
2. hard pre-restore rejection versus future migration-hook behavior
In practice, the first delivery becomes much easier to review if it answers a few concrete questions clearly:
- where the minimal version metadata lives
- who compares producer version versus readable version range
- what exact error users see when compatibility is not satisfied
- how maintainers are expected to document state-breaking changes in release notes and upgrade guidance
I agree this should stay discussion-first. If the community can first align on a minimal compatibility promise and explicit blocking behavior, later connector-specific migration work can remain additive instead of becoming part of the first contract.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Discussion][Connector-V2] Define connector state versioning and restore compatibility checks [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #11406:
URL: https://github.com/apache/seatunnel/issues/11406#issuecomment-5040697103
This is converging in a good direction.
I agree with keeping the v1 contract focused on those four points and not forcing one serializer wire shape too early. The important part for users is not whether the metadata sits in a header, sidecar, or wrapper, but that restore compatibility is decided before normal restore proceeds and fails with one clear, predictable outcome.
The next piece I think this discussion should make explicit is the operator-facing contract: one concrete incompatibility example, the exact error shape users see, and how that message points them toward the right upgrade note / release note / migration guidance. Without that, we can still agree on the metadata model and end up with inconsistent restore failures across connectors.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org