rdblue commented on a change in pull request #1110:
URL: https://github.com/apache/iceberg/pull/1110#discussion_r440483089



##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -250,21 +253,40 @@ public String toString() {
     for (HistoryEntry logEntry : snapshotLog) {
       if (last != null) {
         Preconditions.checkArgument(
-            (logEntry.timestampMillis() - last.timestampMillis()) >= 0,
+            (logEntry.timestampMillis() - last.timestampMillis()) >= 
-ONE_MINUTE,
             "[BUG] Expected sorted snapshot log entries.");
       }
       last = logEntry;
     }
+    if (last != null) {
+      Preconditions.checkArgument(
+          // commits can happen concurrently from different machines.
+          // A tolerance helps us avoid failure for small clock skew
+          lastUpdatedMillis - last.timestampMillis() >= -ONE_MINUTE,
+          "Invalid update timestamp %s: before last snapshot log entry at %s",
+          lastUpdatedMillis, last.timestampMillis());
+    }
 
     MetadataLogEntry previous = null;
     for (MetadataLogEntry metadataEntry : previousFiles) {
       if (previous != null) {
         Preconditions.checkArgument(
-            (metadataEntry.timestampMillis() - previous.timestampMillis()) >= 
0,
+            // commits can happen concurrently from different machines.
+            // A tolerance helps us avoid failure for small clock skew
+            (metadataEntry.timestampMillis() - previous.timestampMillis()) >= 
-ONE_MINUTE,
             "[BUG] Expected sorted previous metadata log entries.");
       }
       previous = metadataEntry;
     }
+      // Make sure that this update's lastUpdatedMillis is > 
max(previousFile's timestamp)

Review comment:
       Nit: indentation is off.




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

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