hibernate-orm
hibernate-orm copied to clipboard
Hhh 18377a
Jira issue HHH-18377
This pull requests is update to #8719
- Fixed bug in UUID version 6 generation
- Simplified and slightly improved UUID version 7 generation
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion. For more information on licensing, please check here.
Thanks for your pull request!
This pull request appears to follow the contribution rules.
› This message was automatically generated.
The implementation looks ok to me now, but I'm having a really hard time figuring out what a good implementation for this is in the first place. So far, I was trying to follow https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html#section-4.3.4 which uses a slightly different algorithm for the clock sequence part i.e. only generate a random clock sequence if the clock runs backwards, whereas your implementation does it the other way around. I can't judge what a good algorithm is for all this, but I'm kind of disappointed that there is no official guidance or reference algorithm. It seems like implementors have to figure this out for themselves.
Question is what can guarantee that randomly generated sequence will be larger than previous one? If not, there is chance, small one, but still not impossible, that next UUID will be smaller than last one. I was looking at RFC section "Monotonic Error Checking". It was published in May 2024, while draft was published in October 2021, and both are mentioning old RFC 4122