szehon-ho commented on code in PR #12334:
URL: https://github.com/apache/iceberg/pull/12334#discussion_r1978283986


##########
format/spec.md:
##########
@@ -1754,6 +1754,14 @@ Snapshot summary can include metrics fields to track 
numeric stats of the snapsh
 | **`engine-name`**        | "spark"    | Name of the engine that created the 
snapshot                    |
 | **`engine-version`**     | "3.5.4"    | Version of the engine that created 
the snapshot                 |
 
+### Assignment of Snapshot IDs and `current-snapshot-id`
+
+Writers should produce positive values for snapshot ids in a manner that 
minimizes the probability of id collisions and should verify the id does not 
conflict with existing snapshots. Producing snapshot ids based on timestamps 
alone is not recommended as it increases the potential for collisions.
+
+The reference implementation uses a type 4 uuid and XORs the 4 most 
significant bytes with the 4 least significant bytes then ANDs with the maximum 
long value to arrive at a pseudo-random snapshot id with a low probability of 
collision.
+
+The reference Java implementation writes `-1` for "no current snapshot" with 
V1 and V2 tables and considers this equivalent to omitted or `null`. This has 
never been formalized in the spec but for compatibility, other implementations 
can accept `-1` as `null`. Java will no longer write `-1` and will use `null` 
for "no current snapshot" for all tables with a version greater than or equal 
to V3.

Review Comment:
   Should we just put 'The reference Java implementation' in the first pargraph 
then the first time we mention it?
   
   `The reference Java implementation uses a type 4 uuid and XORs the 4 most 
significant bytes with the 4 least significant bytes then ANDs with the maximum 
long value to arrive at a pseudo-random snapshot id with a low probability of 
collision.`
   
   And then can use Java threafter (including the second paragraph)?  Then its 
more clear that both paragraph refer to the same one.
   



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

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


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

Reply via email to