-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(database): introduce Snowflake IDs generator #55728
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Is it additional to #55710? 🤔 |
faa65d0 to
0815707
Compare
Collaborator
Author
Not really… We discussed it at Contributor Week but I lacked time to finish so I just pushed what I had. |
ff2de9d to
c655e83
Compare
36b621a to
2b85fe3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
d187a2e to
a62c8b2
Compare
CarlSchwan
approved these changes
Oct 23, 2025
a62c8b2 to
1c78c60
Compare
This comment was marked as resolved.
This comment was marked as resolved.
1c78c60 to
6766d0a
Compare
Collaborator
Author
|
Unrelated red CI, documentation added in nextcloud/documentation#13811 |
6766d0a to
4b1fce7
Compare
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Allow to get an id for the storing the preview on disk before inserting the preview on the DB. Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
ae7d14e to
336cc3f
Compare
skjnldsv
approved these changes
Oct 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Introduce Snowflake IDs generator/decoder
See https://en.wikipedia.org/wiki/Snowflake_ID for more info
Documentation in feat: add Snowflake IDs information documentation#13811
TODO
Implementation notes
Format
Snowflake IDs use 64 bits. I chose to split them like this:
Issues with 32 bits
On 32 bits systems, 64 bits int are stored in
float.The problem is
floatare losing precision with large numbers like numbers used here so when loading a number, the sequence ID can change.So, Snowflake IDs are given as
stringfor 64 bits and 32 bits systems.Server ID
For now, take a hash of hostname. Can be improved with a mapping of server with a server ID.
Sequence ID
PHP-FPM and Apache module share memory and allow the use of
apcu_incto keep sequence ID.For CLI, fallback to random (shared cache dropped)
Decode tool
TODO
Checklist
3. to review, feature component)stable32)