-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v6] Python implementation increments timestamp instead of clock sequence #4
Comments
Hey @nerg4l, I have been meaning to fix it in v6 prototype but have not found the time. |
@nerg4l Sequence Counter Logic:
Testing v6 with Dev Debugs enabled seems to increment properly but let me know what you think. |
I think it is better to manage the sequence this way. The previous logic altered the time segment which meant whenever someone would read it from the generated uuid they would get an incorrect result. Just remove RFC 4122 - Section 4.1.5 says the following about clock sequence:
I don't know how important to respect this requirement in case of v6. The 48 random bit should be enough to avoid collisions. |
@nerg4l As for the v6: Furthermore, if I recall in testing random Seq start in v8 prototype I found that random sequence counter greatly increased the change the Seq would rollover causing out of order UUIDs. Or if the rollover isn't handled properly overflows where the Seq becomes larger than the space it was meant to encompass resulting in UUIDs larger than 128 bits. Thus is the reason why I stated v7 and v8 like so:
I will discuss with Brad and update draft 02 where required to state that the sequence should start at 0 and increase by 1. Exactly like we do in v7/v8. |
I had the same observation while writing an implementation for v6.
I think that would be a great addition. It would also make the sequence reusable between v6, v7, and v8. When you discuss this don't forget to take into consideration the rule for systems/languages which cannot provide 100-nanosecond timestamps (e.g. JavaScript in the browser). RFC 4122 - Section 4.2.1.2. suggests the following:
At the moment, there are 3 ways which comes to my mind.
The most optimal would be Option 3 but it might add a lot of unnecessary complexity. |
While having a look at the python prototype and reading the "UUIDv6 Basic Creation Algorithm" section of the draft I noticed a difference between them.
From Section 4.3.4.
prototypes/python/new_uuid.py
Lines 35 to 39 in 98bc0c1
I think the implementation in the linked code segment increments the timestamp when it should increment the clock sequence instead.
The text was updated successfully, but these errors were encountered: