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 2022/05/01 22:55:30 UTC

[GitHub] [iceberg] amogh-jahagirdar commented on a diff in pull request #4578: Core: Update Remove Snapshots procedure for branching and tagging

amogh-jahagirdar commented on code in PR #4578:
URL: https://github.com/apache/iceberg/pull/4578#discussion_r862531302


##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -163,21 +180,86 @@ private TableMetadata internalApply() {
     this.base = ops.refresh();
 
     Set<Long> idsToRetain = Sets.newHashSet();
-    List<Long> ancestorIds = SnapshotUtil.ancestorIds(base.currentSnapshot(), base::snapshot);
-    if (minNumSnapshots >= ancestorIds.size()) {
+    // Identify refs that should be removed
+    Set<String> refsToRemove = Sets.newHashSet();
+    for (String name : base.refs().keySet()) {
+      SnapshotRef ref = base.ref(name);
+      if (!name.equals(SnapshotRef.MAIN_BRANCH) && ref.maxRefAgeMs() != null) {

Review Comment:
   You are correct, I missed in the spec, there's a table level property for max-ref-age-ms that we want to default to. The same applies for the other retention properties. This behavior makes more sense. I will update to fix this. 



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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