qidian99 commented on code in PR #1168:
URL: https://github.com/apache/incubator-paimon/pull/1168#discussion_r1197630566
##########
paimon-core/src/main/java/org/apache/paimon/operation/FileStoreExpireImpl.java:
##########
@@ -88,6 +89,12 @@ public FileStoreExpireImpl(
SnapshotManager snapshotManager,
ManifestFile.Factory manifestFileFactory,
ManifestList.Factory manifestListFactory) {
+ Preconditions.checkArgument(
+ numRetainedMin >= 1,
+ "The minimum number of completed snapshots to retain should be
>= 1.");
+ Preconditions.checkArgument(
+ numRetainedMax > numRetainedMin,
+ "The maximum number of snapshots to retain should be > the
minimum number.");
Review Comment:
Yes you are correct. I was confused by the following code in snapshot
expiration.
```java
// find the earliest snapshot to retain
for (long id = Math.max(latestSnapshotId - numRetainedMax + 1,
earliest);
id <= latestSnapshotId - numRetainedMin;
id++) {
if (snapshotManager.snapshotExists(id)
&& currentMillis -
snapshotManager.snapshot(id).timeMillis()
<= millisRetained) {
// within time threshold, can assume that all snapshots
after it are also within
// the threshold
expireUntil(earliest, id);
return;
}
}
```
This segment tries to locate the first snapshot within a range of snapshots,
specifically between the numRetainedMax th and numRetainedMin th latest
snapshots. This snapshot needs to be preserved because it doesn't fulfill the
time threshold condition for expiration.
I've updated the comment to be more clear.
--
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]