diff options
author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2022-06-30 14:37:22 +0300 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2022-06-30 14:37:22 +0300 |
commit | 0c997f89c4edaaf5c7f977588e761f0d8165605c (patch) | |
tree | 412aedacf7b058ab65381c6b347bfd753d3ee6bb | |
parent | 7d2f78741471e00349f332604e02d7cb478fe86a (diff) | |
download | mariadb-git-bb-10.10-MDEV-28771.tar.gz |
speed up main.alter_table_online_debugbb-10.10-MDEV-28771
-rw-r--r-- | mysql-test/main/alter_table_online_debug.result | 4 | ||||
-rw-r--r-- | mysql-test/main/alter_table_online_debug.test | 4 | ||||
-rw-r--r-- | sql/sql_table.cc | 11 |
3 files changed, 14 insertions, 5 deletions
diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result index 08c473906f3..244a926fea9 100644 --- a/mysql-test/main/alter_table_online_debug.result +++ b/mysql-test/main/alter_table_online_debug.result @@ -58,8 +58,9 @@ insert t1 values (5); connection con2; set debug_sync= 'now WAIT_FOR ended'; connection default; +set @old_dbug= @@debug_dbug; +set debug_dbug= "+d,alter_table_online_timeout_fast"; set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end'; -set session lock_wait_timeout=1; alter table t1 add b int NULL, algorithm= copy, lock= none; connection con2; start transaction; @@ -70,6 +71,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction select * from t1; a 5 +set debug_dbug= @old_dbug; set session lock_wait_timeout=default; connection con2; rollback; diff --git a/mysql-test/main/alter_table_online_debug.test b/mysql-test/main/alter_table_online_debug.test index cacd8cd1e12..9f586825b61 100644 --- a/mysql-test/main/alter_table_online_debug.test +++ b/mysql-test/main/alter_table_online_debug.test @@ -75,8 +75,9 @@ insert t1 values (5); set debug_sync= 'now WAIT_FOR ended'; --connection default +set @old_dbug= @@debug_dbug; +set debug_dbug= "+d,alter_table_online_timeout_fast"; set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end'; -set session lock_wait_timeout=1; --send alter table t1 add b int NULL, algorithm= copy, lock= none; @@ -90,6 +91,7 @@ set debug_sync= 'now SIGNAL end'; --error ER_LOCK_WAIT_TIMEOUT --reap select * from t1; +set debug_dbug= @old_dbug; set session lock_wait_timeout=default; --connection con2 rollback; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8e26593fcb2..9f41faa1cf9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11866,9 +11866,14 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, DEBUG_SYNC(thd, "alter_table_online_before_lock"); - int lock_error= - thd->mdl_context.upgrade_shared_lock(from->mdl_ticket, MDL_EXCLUSIVE, - (double)thd->variables.lock_wait_timeout); + double lock_wait_timeout= (double)thd->variables.lock_wait_timeout; + DBUG_EXECUTE_IF("alter_table_online_timeout_fast", + lock_wait_timeout= 0.001;); + + + int lock_error= thd->mdl_context.upgrade_shared_lock(from->mdl_ticket, + MDL_EXCLUSIVE, + lock_wait_timeout); if (!error) error= lock_error; |