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


##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -161,21 +174,89 @@ public List<Snapshot> apply() {
 
   private TableMetadata internalApply() {
     this.base = ops.refresh();
+    if (base.refs().isEmpty()) {

Review Comment:
   Ah yes, good catch, this should actually be base.snapshots().isEmpty() to 
early return in case there is no snapshots to expire. Currently, we do not 
create a main branch when we read the metadata. Only when there are snapshots 
produced do we actually create the main ref at that moment. 
   
   To prevent the situation where a user uses the new procedure on existing 
metadata where no new snapshots have been produced using the newer library (and 
thus no main branch has been created) and this blocks expiration, I think just 
using the snapshot list size as a source of truth should suffice for any early 
return.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to