fqaiser94 commented on code in PR #6513:
URL: https://github.com/apache/iceberg/pull/6513#discussion_r1623745433


##########
core/src/main/java/org/apache/iceberg/SnapshotManager.java:
##########
@@ -181,4 +182,12 @@ public void commit() {
       transaction.commitTransaction();
     }
   }
+
+  @Override
+  public void commitIf(List<Validation> validations) {
+    commitIfRefUpdatesExist();
+    // Add a no-op UpdateProperties to add given validations to transaction
+    transaction.updateProperties().commitIf(validations);
+    commit();
+  }

Review Comment:
   `SnapshotManager` is the only `PendingUpdate` implementation where I have to 
implement the `commitIf` method "by hand" i.e. I can't just extend 
`BasePendingUpdate` like all the other implementations. This is because of the 
way `SnapshotManager` is implemented in terms of `Transaction` which means I 
don't have access to any base `TableMetadata` to `validate` directly. Instead, 
I add a conditional, no-op `UpdateProperties` to the underlying transaction 
which then  validates the current table state as part of the `Transaction` 
commit process. 
   



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to