summaryrefslogtreecommitdiff
path: root/mysql-test/main/alter_table.result
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2021-11-02 04:52:03 +0300
committerAleksey Midenkov <midenok@gmail.com>2021-11-02 04:52:03 +0300
commit63c922ae0c9e5896505f3843eeb0524ae97fe779 (patch)
tree895298d1605b34f5f854969f4c642c65418b7829 /mysql-test/main/alter_table.result
parent1203b65849cd1ecefe5f2df07f3165b9aa5e2a9d (diff)
downloadmariadb-git-63c922ae0c9e5896505f3843eeb0524ae97fe779.tar.gz
MDEV-25803 Inplace ALTER breaks MyISAM/Aria table when order of keys is changed
mysql_prepare_create_table() does my_qsort(sort_keys) on key info. This sorting is indeterministic: a table is created with one order and inplace alter may overwrite frm with another order. Since inplace alter does nothing about key info for MyISAM/Aria storage engines this results in discrepancy between frm and storage engine key definitions. The fix avoids the sorting of keys when no new keys added by ALTER (and this is ok for MyISAM/Aria since it cannot add new keys inplace). Notes: mi_keydef_write()/mi_keyseg_write() are used only in mi_create(). They should be used in ha_inplace_alter_table() as well. Aria corruption detection is unimplemented: maria_check_definition() is never used! MySQL 8.0 has this bug as well as of 8.0.26. This breaks main.long_unique in 10.4. The new result is correct and should be applied as it just different (original) order of keys.
Diffstat (limited to 'mysql-test/main/alter_table.result')
-rw-r--r--mysql-test/main/alter_table.result16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index 8a3fc640301..522c4bf872b 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -2584,5 +2584,21 @@ set max_statement_time= 0;
drop table t1;
drop view v1;
#
+# MDEV-25803 Inplace ALTER breaks MyISAM/Aria tables when order of keys is changed
+#
+set @save_default_engine= @@default_storage_engine;
+create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x)) engine myisam;
+alter table t1 change x xx int, algorithm=inplace;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+create or replace table t1 (x int, y int, unique (y), unique (x), primary key(x));
+alter table t1 change x xx int, algorithm=inplace;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+set @@default_storage_engine= @save_default_engine;
+#
# End of 10.3 tests
#