yathindranath commented on a change in pull request #497: Support retaining 
last N snapshots
URL: https://github.com/apache/incubator-iceberg/pull/497#discussion_r329741161
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
 ##########
 @@ -310,6 +323,19 @@ private void deleteDataFiles(Set<String> manifestsToScan, 
Set<String> manifestsT
     return filesToDelete;
   }
 
+  private Snapshot findNthSnapshot(int snapshotIndex) {
+    Snapshot lastSnapshot = base.currentSnapshot();
+    int snapshotCount = 1;
+    while (lastSnapshot != null) {
+      if (snapshotCount == snapshotIndex) {
+        return lastSnapshot;
+      }
+      snapshotCount++;
+      lastSnapshot = (lastSnapshot.parentId() != null) ? 
base.snapshot(lastSnapshot.parentId()) : null;
 
 Review comment:
   @rdblue thanks for the review.
   
   The current implementation in the PR doesn't expire snapshots which are 
laterThan the `expireOlderThan` timestamp regardless of ancestors. 
   
   If we keep the implementation as is, it should take care of the staging 
commits. The only issue is, it will retain N recent versions + recent snapshots 
which are not ancestors. 
   
   If this is okay, will not add any new methods to expire rolled back 
snapshots.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to