From 5cae401b00425746f157f448f2a8447d112cabdb Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Wed, 3 Nov 2021 12:31:47 +0300 Subject: MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table Drop and add same key is considered rename (look ALTER_RENAME_INDEX in fill_alter_inplace_info()). But in this case order of keys may be changed, because mysql_prepare_alter_table() yet does not know about rename and treats 2 operations: drop and add. In that case we disable inplace algorithm for such engines as Memory, MyISAM and Aria with ALTER_INDEX_ORDER flag. These engines have no specialized check_if_supported_inplace_alter() and default handler::check_if_supported_inplace_alter() sees an unknown flag and returns HA_ALTER_INPLACE_NOT_SUPPORTED. ha_innobase::check_if_supported_inplace_alter() works differently and inplace is not disabled (with the help of modified INNOBASE_INPLACE_IGNORE). add_drop_v_cols fork was also tweaked as it wrongly failed with MSG_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN when it seen ALTER_INDEX_ORDER. No-op operation must be still no-op no matter of ALTER_INDEX_ORDER presence, so we tweek its condition as well. --- mysql-test/main/alter_table.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mysql-test/main/alter_table.test') diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index 85725820677..4f5cf8665d4 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -2608,6 +2608,18 @@ check table t1; drop table t1; set @@default_storage_engine= @save_default_engine; +--echo # +--echo # MDEV-25555 Server crashes in tree_record_pos after INPLACE-recreating index on HEAP table +--echo # +create table t1 (a int, key idx1(a), key idx2 using btree(a)) engine=memory; +alter table t1 rename index idx1 to idx3, algorithm=inplace; +delete from t1 where a = 10; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t1 drop key idx3, add key idx1(a), algorithm=inplace; +delete from t1 where a = 11; +# cleanup +drop table t1; + --echo # --echo # End of 10.5 tests --echo # -- cgit v1.2.1