akalash opened a new pull request, #29907: URL: https://github.com/apache/flink/pull/29907
## What is the purpose of the change
When a job restores from a savepoint,
`CheckpointCoordinator#restoreSavepoint` builds placeholder
`CheckpointProperties` per `RecoveryClaimMode`: `NO_CLAIM` and `LEGACY`
hardcode `CANONICAL`,
and `CLAIM` uses the coordinator's own checkpoint properties. The same
placeholders were reported to the stats tracker, so a restored `NATIVE`
savepoint is reported as `CANONICAL`, and a
savepoint restored with `CLAIM` is reported as a plain checkpoint.
`RestoredCheckpointStats#getProperties()` is the only place the restored
checkpoint's type is recorded, so it should describe
what was restored.
The original properties, including the real `SavepointType`, are already
persisted in `_metadata` (V4+) and exposed as
`CompletedCheckpoint#getRestoredProperties()`. This PR reports those
instead.
## Brief change log
- `CheckpointCoordinator`: report
`latest.getRestoredProperties().orElse(latest.getProperties())` to the stats
tracker. The placeholders still drive claiming and cleanup
(`forceFullSnapshot`,
shared-state registration), so restore behaviour is unchanged. Metadata
older than V4 has no persisted properties and keeps reporting the placeholder.
- `CheckpointCoordinatorRestoringTest`: new parameterized test that
restores a real savepoint of each format in each claim mode.
### What changes for readers of the restored properties
The only reader in main code is `CheckpointingStatisticsHandler`, which
exposes `isSavepoint()` as `latest.restored.is_savepoint` (REST, history
server, and the web UI's *Latest Restore →
Type*). The format is not exposed over REST, only through
`RestoredCheckpointStats#getProperties()`.
| Restored from | Claim mode | `is_savepoint` (REST / UI) |
`getProperties()` (Java API) |
|---|---|---|---|
| Savepoint, either format | CLAIM | false → **true** | checkpoint →
**savepoint with its real format** |
| CANONICAL savepoint | NO_CLAIM, LEGACY | true, unchanged | unchanged |
| NATIVE savepoint | NO_CLAIM, LEGACY | true, unchanged | CANONICAL →
**NATIVE** |
| Retained checkpoint | NO_CLAIM, LEGACY | true → **false** | savepoint →
**checkpoint** |
| Retained checkpoint | CLAIM | unchanged | unchanged |
| Metadata older than V4 | any | unchanged | unchanged |
The first three rows are covered by the new test. The retained-checkpoint
rows go beyond the issue's wording and follow from reading the code, not from a
test: such a checkpoint was only
reported as a savepoint because of the placeholder. Since the persisted
type is reported as is, a savepoint from stop-with-savepoint also keeps its
synchronous type (also untested).
`getProperties()` now returns the persisted properties, so its other
fields (for example `isUnclaimed()`) describe the original checkpoint, not the
restore placeholder. Nothing in main code
reads them from the restored stats.
## Verifying this change
This change added tests and can be verified as follows:
-
`CheckpointCoordinatorRestoringTest#testRestoredSavepointReportsItsRealFormat`
takes a real savepoint through the coordinator in each `SavepointFormatType`,
restores it in each
`RecoveryClaimMode` (6 cases) and checks the restored stats. Without the
fix 4 of the 6 cases fail (CLAIM for both formats, NATIVE under NO_CLAIM and
LEGACY); with it all pass.
- Existing tests in `org.apache.flink.runtime.checkpoint` and the REST
checkpoint handler and message packages pass (602 tests). Checkstyle and
spotless are clean.
- Not run locally: the integration tests in `flink-tests`, a full `mvn
verify`, and a manual run on a cluster.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes, the savepoint
restore path, but only what is reported to the
stats tracker; claiming and cleanup are unchanged
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code (Claude Sonnet 5.5)
--
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]
