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

 ##########
 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:
   If both work with one another, there is no need to let the caller know if 
both are called. I think the right solution is to make the two settings 
compatible.

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