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

 ##########
 File path: core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
 ##########
 @@ -82,6 +83,18 @@ public ExpireSnapshots expireOlderThan(long 
timestampMillis) {
     return this;
   }
 
+  @Override
+  public ExpireSnapshots retainLast(int numSnapshots) {
+    Preconditions.checkArgument(1 < numSnapshots,
+            "Number of snapshots to retain must be at least 1, cannot be: %s", 
numSnapshots);
+    LOG.info("Retaining last {} snapshots and expiring older snapshots", 
numSnapshots);
+    Snapshot nthSnapshot = findNthSnapshot(numSnapshots);
+    if (nthSnapshot != null) {
+      expireOlderThan(nthSnapshot.timestampMillis());
 
 Review comment:
   I agree, will make the changes to both configurations work with one another 
and let the caller know if both are called.

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