UUID integration#1533
Conversation
|
Some points for discussion, personal opinions only. Use v4 (hence the v4 recommendation i.e. using UUID Tiny). v1 is basically what we have (well almost). For security reasons: https://www.ntietz.com/blog/til-uses-for-the-different-uuid-versions/ If we do move forward with UUID, I wouldn't mind a PR that adds just the dependency to the cpanfile. Then stamps and registry could bring it in, these features would not be subject to deprecation burden. Regarding timestamp2UUID deprecation, both would probably need support during the migration period, for the sake of clients. However, we can do a couple things:
The remapping of timestamp2UUID would need to be transactional. If UUID variant is created but timestamp is not linked then we have duplicates. If timestamp isn't linked to UUID LRR may create another UUID variant, which is also a duplicate. There are several other scenarios like locking/concurrency (we're writing on two tanks basically) or downgrades back to timestamp. |
|
Yes, the UUID was just the example in the docs that I integrated quickly to open this PR, but V4 is most surely the one we will go, since that one is probably better for uniqueness. I don't think this will be integrated to Stamps, which is the reason I separated it into this PR. Stamps(Pendant from Difegue's comments about changes in the DB) currently uses the archive id in the name to link archives with stamps, and in the keys it uses timestamps for sorting and creation date, so no point in changing that to a UUID(Although I'll change the timestamp to real milliseconds, since I think I found a way to do it correctly). About the migration from timestamps, on my personal opinion, I think the best way to integrate that would be to add a plugin to convert the TS keys to UUID ones, so that way instead of running a one time script on server upgrade to do this, or adding a piece of code that would do this on runtime, you could just run the plugin once, it will fix everything, and even if something fails later, and you need to restore a backup, you can run it again. The plugin could also do the reverse for the downgrade, although it would no return it to the original TS, but a new one. |
|
BUG: A potential bug to appear with this integration is that Archive depends on being the only Hash table with 40 chars key, due to us using |
|
I initially thought stamps could remain on timestamps for now, but UUID is something we might want to bring in for the registry... although tbh I also did think registry storage could just rely on plugin IDs since that's also what's used for saving settings anyway. I'd also be inclined to one-shot the migration, but at the same time I don't think we can avoid having to support both, just in case third-party clients are saving category IDs on their side. i might get crucified for this but 2038 technically isn't that big of a deal, timestamps within LRR for IDs are just used for unicity so frankly who cares if we end up with TANK_000003 at some point 🤷 |
This is just a simple example of how to integrate UUID::Tiny to use for the hash table IDs. This example generates a Timestamp like we currently do, but generates an MD5 UUID from it, which is always 36 characters long, so we only need to update the KEYS string to TANK_????????-????-????-????-???????????? to make it compatible. This of course would require far more work, like an script to migrate all existent tanks to the new format, but is enough for the moment for demonstration purposes.
I didn't add any dependency to LRR install scripts, since I want to know first if this a good approach, and if UUID::Tiny is the right version to use, or we can choose a different one, so if you want to test this branch you would need to install manually the module in your environment, but the good news is that if everything works correctly, we can get rid of the ominous "Can't wait for 2038!" message 😸