Skip to content

Commit

Permalink
MDEV-29959 UUID Sorting
Browse files Browse the repository at this point in the history
* UUIDs version >= 6 are now stored without byte-swapping
* UUIDs with version >=8 and variant=0 are now considered invalid
* old tables are supported
* old (always byte swapped) and new (swapped for version < 6) UUIDs
  can be compared and converted transparently
  • Loading branch information
vuvova committed Jul 5, 2023
1 parent 8bf25f3 commit ef84f81
Show file tree
Hide file tree
Showing 12 changed files with 894 additions and 317 deletions.
2 changes: 1 addition & 1 deletion plugin/type_uuid/item_uuidfunc.cc
Expand Up @@ -33,7 +33,7 @@ String *Item_func_sys_guid::val_str(String *str)

const Type_handler *Item_func_uuid::type_handler() const
{
return UUIDBundle::singleton();
return Type_handler_uuid_new::singleton();
}

bool Item_func_uuid::val_native(THD *, Native *to)
Expand Down
425 changes: 425 additions & 0 deletions plugin/type_uuid/mysql-test/type_uuid/order.result

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions plugin/type_uuid/mysql-test/type_uuid/order.test
@@ -0,0 +1,26 @@
# try all combinations of version and variant
source include/have_sequence.inc;

create table t1 (a uuid, b int not null, index (a));
insert t1 select sformat('11223344-5566-{:x}777-{}888-99aabbccddee', seq div 4, elt(1+(seq % 4),0,8,'c','e')),seq from seq_0_to_63;
select * from t1;
select * from t1 order by a;
show create table t1;

--echo # now let's use the table as above, but created in 10.11.4
let $datadir= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.frm $datadir/test/t2.frm
--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.MYI $datadir/test/t2.MYI
--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.MYD $datadir/test/t2.MYD
select * from t2;
select * from t2 order by a;
show create table t2;

select * from t1, t2 where t1.a=t2.a;

--sorted_result
select * from t1 union select * from t2;

alter ignore table t2 force;

drop table t1, t2;
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit ef84f81

Please sign in to comment.