Anton Kalashnikov created FLINK-41466:
-----------------------------------------
Summary: Restored savepoint's CheckpointProperties always report
CANONICAL format, regardless of the actual savepoint format
Key: FLINK-41466
URL: https://issues.apache.org/jira/browse/FLINK-41466
Project: Flink
Issue Type: Bug
Reporter: Anton Kalashnikov
Assignee: Anton Kalashnikov
h2. Problem
When a job is restored from a savepoint,
\{{CheckpointCoordinator#restoreSavepoint}} builds the
\{{CheckpointProperties}} attached to the restored checkpoint. These properties
are then recorded through \{{CheckpointStatsTracker#reportRestoredCheckpoint}}
and exposed via \{{RestoredCheckpointStats#getProperties()}}.
In the two claim modes that treat the restored checkpoint as a savepoint, the
savepoint format in these properties is hardcoded to CANONICAL:
* \{{NO_CLAIM}} (the default): \{{CheckpointProperties.forUnclaimedSnapshot()}}
uses \{{SavepointType.savepoint(SavepointFormatType.CANONICAL)}}.
* \{{LEGACY}}: \{{CheckpointProperties.forSavepoint(false,
SavepointFormatType.CANONICAL)}}, with the code comment "we do not care about
the format when restoring".
As a result, a job restored from a NATIVE savepoint ends up with a restored
checkpoint whose properties say CANONICAL. The recorded type does not describe
what was actually restored. According to the code comment the restore logic
does not depend on the format, so only the recorded metadata is wrong.
h2. Why it matters
The restored checkpoint's properties are the only place where its type is
recorded, and for NATIVE savepoints the recorded format is wrong. Anything that
reads them (REST handlers, metrics, custom code built on
\{{RestoredCheckpointStats}}) gets a misleading answer. In particular, the
format of the restored checkpoint cannot be surfaced (for example next to
\{{is_savepoint}} in the \{{latest.restored}} part of the checkpoint statistics
REST response) without exposing a wrong value.
h2. How to reproduce (from code reading, not yet verified with a test)
# Run a job with the RocksDB state backend and take a savepoint with \{{--type
native}}.
# Restore from it with the default claim mode (\{{NO_CLAIM}}).
# Inspect \{{RestoredCheckpointStats#getProperties().getCheckpointType()}}: it
is a \{{SavepointType}} whose format is CANONICAL.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)