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 2021/04/26 03:01:58 UTC

[GitHub] [iceberg] openinx commented on a change in pull request #2506: Ensure snapshot ID is positive

openinx commented on a change in pull request #2506:
URL: https://github.com/apache/iceberg/pull/2506#discussion_r619942779



##########
File path: core/src/main/java/org/apache/iceberg/TableOperations.java
##########
@@ -117,7 +117,7 @@ default long newSnapshotId() {
     UUID uuid = UUID.randomUUID();
     long mostSignificantBits = uuid.getMostSignificantBits();
     long leastSignificantBits = uuid.getLeastSignificantBits();
-    return Math.abs(mostSignificantBits ^ leastSignificantBits);
+    return (mostSignificantBits ^ leastSignificantBits) & Long.MAX_VALUE;

Review comment:
       I'm curious whether are there two different `UUID` whose `Math.abs(mostSignificantBits ^ leastSignificantBits)`  are the same.  If so, then we will encounter a duplicated new snapshot id which could be a serious bug ? 




-- 
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:
users@infra.apache.org



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