You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/14 19:03:13 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #4747: Core: Fix data loss when duplicate snapshot-id is allocated

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


##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -980,11 +980,15 @@ public Builder addSortOrder(SortOrder order) {
     }
 
     public Builder addSnapshot(Snapshot snapshot) {
-      if (snapshot == null || snapshotsById.containsKey(snapshot.snapshotId())) {
+      if (snapshot == null) {
         // change is a noop
         return this;
       }
 
+      ValidationException.check(!snapshotsById.containsKey(snapshot.snapshotId()),
+          "Snapshot already exist for the id: %s",
+          snapshot.snapshotId());

Review Comment:
   @RussellSpitzer, what do you think about this? Any situations where you think this would cause an issue because we add the same snapshot and rely on the operation being idempotent?



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

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


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