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
Are Sonyflakes strings always guaranteed to be in order and the same length? #18
Comments
In other words we need to identify what our runway is before we have to do a system migration! |
Hi, Sonyflake guarantees the uniqueness of its generated IDs. But its order is not always time order if you use multiple machine IDs. As you know, if you convert Sonyflake IDs, which are originally uint64, to strings, its order is not time order but lexical order. I think Sonyflake is not suitable for time-order guarantee. But you can guarantee time order if you use Sonyflake under the following constraints:
|
@YoshiyukiMineo Thank you for getting back. The configuration we use for the Sonyflake is as follows...
So 16. Which means that all machine IDs have been a single "constant" machine ID up to now; such that BitLenMachineID=16 |
Hi!
We would like to know if sonyflakes generated from now are a guaranteed sort order and if not then when is the next time that length will change. We have noticed an issue in our database where our sort order is being ill-computed based on that we sometimes store sonyflakes as strings. Could you kindly affirm whether the length of a sonyflake string can change? Or is there a guaranteed length.
In particular the following algorithm...
Shows that say the number
2 > 1000000000000000
when doing string comparison. I would like to know how Sonyflakes generated reliably are affected by this as the impact of this could affect the sort ordering for some production data (may require migration). Due to the algorithmic complexity of the Sonyflake and how its generated (sonyflakes are always the same length I believe) I'm not sure if we would be impacted by this in the near future.Go example
I appreciate that this is not your concern and represents a mistake made in our systems, however I would appreciate any help on the matter. It would be helpful if I can run unit tests locally to generate snowflake now to the range generate one years in the future, but I have no idea how to adjust the snowflake without changing my system time like this. Appreciate the easiest way to diagnose the impact!
The text was updated successfully, but these errors were encountered: