From 3059f274fb985289855fe37c6598d6f3a27dd30f Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Wed, 31 Jan 2024 19:59:07 +0100 Subject: [PATCH] online alter: relax the lock to upgrade to on the last replication stage This will allow selects pass until the rename/commit stage. The lock is anyway upgraded to MDL_EXCLUSIVE later by the wait_while_table_is_used call in mysql_alter_table. --- sql/sql_table.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2b1228ac82f..788f6e19679 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -12354,7 +12354,7 @@ 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, + thd->mdl_context.upgrade_shared_lock(from->mdl_ticket, MDL_SHARED_NO_WRITE, (double)thd->variables.lock_wait_timeout); if (!error) error= lock_error;