Dennis-Mircea commented on code in PR #1185:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1185#discussion_r4719255159
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/SnapshotObserver.java:
##########
@@ -278,6 +283,12 @@ Set<FlinkStateSnapshot> getFlinkStateSnapshotsToCleanUp(
var snapshotList =
snapshots.stream()
.filter(s -> !s.isMarkedForDeletion())
+ .filter(
+ s ->
+ s.getStatus() != null
+ && s.getStatus().getState() !=
null
+ &&
CLEAN_UP_SNAPSHOT_STATES.contains(
Review Comment:
Really good point. The current implementation actually fixes the case where
`IN_PROGRESS` and `TRIGGER_PENDING` can be deleted too early, but it
overcorrects the case where deleting those is actually necessary from a
staleness perspective.
The problem actually is that, at 316-319 lines within this file we have this
code block in place:
```java
var ts = EXTRACT_SNAPSHOT_TIME.apply(snapshot).toEpochMilli();
if (snapshotList.size() - result.size() > maxCount || ts < maxTms) {
result.add(snapshot);
}
```
This code makes the `maxTms` (the max age that can be used for staleness)
to be tackled as a second variant, not as a top priority rule over all current
existing snapshots. So, the logic that should be refactored, refined, and
filtered should be there, and the initial snapshot list to stay the same as it
is now.
NOTE: While checking and reproducing this, I discovered that a stale
`IN_PROGRESS` savepoint gets stuck in the cleanup process as the
`StateSnapshotReconciler#cleanup` loops forever when the disposal on delete
flag is set to true. To fix this, I created the
[FLINK-41710](https://issues.apache.org/jira/browse/FLINK-41710) JIRA.
--
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]