JingsongLi commented on code in PR #8883:
URL: https://github.com/apache/paimon/pull/8883#discussion_r3679500098


##########
paimon-core/src/main/java/org/apache/paimon/utils/SnapshotManager.java:
##########
@@ -272,6 +272,46 @@ public boolean earliestFileNotExists() {
         }
     }
 
+    /**
+     * Repairs the earliest snapshot hint to the start of a continuous suffix 
ending at the latest
+     * snapshot and returns the previous earliest snapshot id.
+     */
+    public long repairEarliestSnapshot(long snapshotId) {
+        long previous =
+                Preconditions.checkNotNull(
+                        earliestSnapshotId(),
+                        "Cannot repair earliest snapshot for an empty table.");
+        long latest =
+                Preconditions.checkNotNull(
+                        latestSnapshotId(), "Cannot repair earliest snapshot 
for an empty table.");
+        Preconditions.checkArgument(
+                snapshotId >= previous,
+                "Snapshot %s must not be earlier than current earliest 
snapshot %s.",
+                snapshotId,
+                previous);
+        Preconditions.checkArgument(
+                snapshotId <= latest,
+                "Snapshot %s must not be later than latest snapshot %s.",
+                snapshotId,
+                latest);
+        for (long id = snapshotId; ; id++) {
+            Preconditions.checkArgument(snapshotExists(id), "Snapshot %s does 
not exist.", id);

Review Comment:
   Maybe it is too slow, we should add threads to accelerate it.



-- 
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]

Reply via email to