MDEV-11339 Support UUID v4 generation#3143
MDEV-11339 Support UUID v4 generation#3143StefanoPetrilli wants to merge 1 commit intoMariaDB:11.5from
Conversation
7bb45a6 to
0c73d9f
Compare
0c73d9f to
92a50b1
Compare
grooverdan
left a comment
There was a problem hiding this comment.
Thanks for address @abarkov 's review.
Just addressing the windows compile issue, and get ready for a 11.6 and will be ready.
Thanks for the contribution.
plugin/type_uuid/mysql-test/type_uuid/func_uuidv4_plugin.result
Outdated
Show resolved
Hide resolved
5350e4d to
67ce722
Compare
|
I see last push went from |
abarkov
left a comment
There was a problem hiding this comment.
Hello Stefano.
Can you please squash the two commits (the code and the tests) into a single commit?
This is how we usually do in MariaDB: the change and the covering test go in a single commit.
Also, I'm seeing some code and CMake changes in the patch with tests. This is confusing why we need a second commit fixing something that was done just in a previous commit. It's better to have everything done properly right in the first commit.
Thanks.
67ce722 to
49e3da0
Compare
abarkov
left a comment
There was a problem hiding this comment.
The patch looks very good. Thanks for addressing review suggestions!
49e3da0 to
debd27f
Compare
|
Hello @StefanoPetrilli. I'm preparing a branch with UUIDv4() for testing by our QA team. I reported this problem as: This is the patch: The class Item_func_uuid now derives from something else than Item_func_sys_guid. Unfortunately, I had to duplicate these methods responsible for non-deterministic behavior: But this change guarantees that the functions UUID(), UUIDv4(), and UUIDv7() soon, have exactly the same behavior with all other SQL expressions returning UUID, like table columns and |
|
After fixing MDEV-33827, I cherry-picked your patch again. Please have a look into this branch: "Fixup" addresses the things we came up during discussions with the team (Daniel Black and Sergey Golubchik):
"Fixup 2" additionally introduces a template Item_func_uuid_vx, to share as much as possible code between UUID() and UUIDv4() and the coming soon UUIDv7(). Do you agree with these additional changes? Do you have any suggestions for further improvements? Note, I'm going to squash the "Fixup" commit into your main commit, if you don't mind. It will remain with your authorship. |
|
Hello @abarkov, My only comment is that falling back to UUIDv1 in case of entropy error might not be the most appropriate choice. If I try to generate a UUIDv4 I would rather get an error than a UUIDv1 because they have different properties and is not what I asked for. What do you think? |
|
Hi @StefanoPetrilli, We discussed with Sergei again. What about another possible solution: Note, sql_rand is a global seed declared in sql/mysqld.cc. |
|
Hello @abarkov, I agree that the probability of an error is close to zero and for this reason I think both versions would be acceptable but personally, I like your last version more. |
|
Thanks @StefanoPetrilli very much for the contribution and making the base. I'm closing this now per MDEV the current version is bb-11.5-bar-MDEV-11339 and is undergoing testing for 11.6. |
Description
UUIDv4 generates random UUIDs, which means they are not based on timestamps or other predictable data. If you require UUIDs that are not predictable or reveal any information about the time they were generated, UUIDv4 is a better choice.
Release Notes
UUIDv4(): returns a UUIDv4How can this PR be tested?
This PR adds automatic tests to test the new function
Basing the PR against the correct MariaDB version
PR quality check