rdblue commented on code in PR #14509:
URL: https://github.com/apache/iceberg/pull/14509#discussion_r2501213108


##########
core/src/main/java/org/apache/iceberg/SnapshotProducer.java:
##########
@@ -327,6 +343,22 @@ public Snapshot apply() {
         writer.toManifestListFile().encryptionKeyID());
   }
 
+  private void runValidations(Snapshot parentSnapshot) {
+    validate(base, parentSnapshot);
+
+    // Validate snapshot ancestry
+    Iterable<Snapshot> snapshotAncestry =
+        parentSnapshot != null
+            ? SnapshotUtil.ancestorsOf(parentSnapshot.snapshotId(), 
base::snapshot)
+            : List.of();
+
+    boolean valid = snapshotAncestryValidator.apply(snapshotAncestry);
+    if (!valid) {
+      String message = snapshotAncestryValidator.errorMessage();
+      throw new ValidationException("Snapshot ancestry validation failed: %s", 
message);

Review Comment:
   This can be shorter:
   ```java
   ValidationException.check(valid, "Snapshot ancestry validation failed: %s", 
validator.errorMessage());
   ```



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