Skip to content

Commit

Permalink
[flink] Bugfix expire snapshot don't work when some snapshot between …
Browse files Browse the repository at this point in the history
…earliest and latest are removed unexpectedly
  • Loading branch information
jiangqiao.xu committed Dec 20, 2024
1 parent 8ade15f commit 0b55a4e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ public int expire() {

// protected by 'snapshot.expire.limit'
// (the maximum number of snapshots allowed to expire at a time)
maxExclusive = Math.min(maxExclusive, earliest + maxDeletes);
long maxExclusiveByExpireLimit = earliest + maxDeletes;
while (!snapshotManager.snapshotExists(maxExclusiveByExpireLimit)) {
// Ensure maxExclusive exist, deal some snapshot between earliest and latest is deleted
maxExclusiveByExpireLimit++;
}
maxExclusive = Math.min(maxExclusive, maxExclusiveByExpireLimit);

for (long id = min; id < maxExclusive; id++) {
// Early exit the loop for 'snapshot.time-retained'
Expand Down

0 comments on commit 0b55a4e

Please sign in to comment.