1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-33993 Possible server hang on DROP INDEX or RENAME INDEX

commit_try_norebuild(): Add the parameter statistics_exist,
similar to commit_try_rebuild(). If the InnoDB statistics tables
did not exist, we will not attempt to update statistics later on
during the transaction.

Thanks to Matthias Leich for originally reproducing this scenario.
This commit is contained in:
Marko Mäkelä
2024-04-25 13:44:10 +03:00
parent 8c8b7da017
commit 0936c13809
3 changed files with 45 additions and 8 deletions

View File

@ -144,15 +144,14 @@ DROP TABLE t;
--echo #
create table t1(f1 int not null primary key,
f2 int not null, index idx(f2))engine=innodb;
f2 int not null, index idx(f2), index i(f2,f1))engine=innodb;
insert into t1 values(1, 1);
connect(con1,localhost,root,,,);
SET DEBUG_SYNC='before_delete_table_stats SIGNAL blocked WAIT_FOR go';
SET innodb_lock_wait_timeout=0;
send ALTER TABLE t1 FORCE, ALGORITHM=COPY;
send SET STATEMENT innodb_lock_wait_timeout=0 FOR
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
connection default;
SET DEBUG_SYNC='now WAIT_FOR blocked';
@ -167,6 +166,21 @@ connection default;
COMMIT;
SET DEBUG_SYNC=RESET;
RENAME TABLE mysql.innodb_table_stats TO mysql.innodb_table_stats_hidden;
connection con1;
SET DEBUG_SYNC='innodb_commit_inplace_before_lock SIGNAL blocked WAIT_FOR go';
send ALTER TABLE t1 DROP INDEX i;
connection default;
SET DEBUG_SYNC='now WAIT_FOR blocked';
RENAME TABLE mysql.innodb_table_stats_hidden TO mysql.innodb_table_stats;
SET DEBUG_SYNC='now SIGNAL go';
connection con1;
reap;
connection default;
SET DEBUG_SYNC=RESET;
connection con1;
ALTER TABLE t1 RENAME KEY idx TO idx1, ALGORITHM=COPY;
disconnect con1;