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


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1270,6 +1262,18 @@ public Builder addSnapshot(Snapshot snapshot) {
           snapshot.sequenceNumber(),
           lastSequenceNumber);
 
+      if (formatVersion >= MIN_FORMAT_VERSION_MONOTONIC_TIMESTAMPS && 
snapshot.parentId() != null) {
+        Snapshot parent = snapshotsById.get(snapshot.parentId());
+        if (parent != null) {
+          ValidationException.check(
+              snapshot.timestampMillis() > parent.timestampMillis(),
+              "Invalid snapshot timestamp %s: not after parent snapshot %s at 
%s",

Review Comment:
   Sorry for the delayed review, maybe in a follow on we can include the 
snapshot ID in the error message, maybe something like 
   
   ```
   "Snapshot %s must have a later timestamp than parent snapshot %s: %s <= %s"
   ```



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