The flag to prefer checkpoints for recovery introduced in
FLINK-11159 returns the wrong checkpoint if:
- checkpoints are preferred (getLatestCheckpoint(true)),
- the latest checkpoint is not a savepoint,
- more than a single checkpoint is retained.
The current implementation assumes that the latest checkpoint is a savepoint and skips over it. I attached a patch for StandaloneCompletedCheckpointStoreTest that demonstrates the issue.
You can apply the patch via git am -3 < *.patch.