You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/10/01 16:40:33 UTC

[GitHub] [incubator-iceberg] rdblue commented on a change in pull request #497: Support retaining last N snapshots

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:
users@infra.apache.org


With regards,
Apache Git Services

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