mirror of
https://github.com/MariaDB/server.git
synced 2026-04-30 04:05:32 +02:00
MDEV-28943 Online alter fails under LOCK TABLE with ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
if ALTER TABLE ... LOCK=xxx is executed under LOCK TABLES, ignore the LOCK clause, because ALTER should not downgrade already taken EXCLUSIVE table lock to SHARED or NONE. This commit preserves the existing behavior (LOCK was de facto ignored), but makes it explicit.
This commit is contained in:
parent
2ed03a41e6
commit
845c939601
3 changed files with 99 additions and 1 deletions
|
|
@ -10029,7 +10029,6 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
|
|||
if (alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED
|
||||
|| alter_info->requested_lock > Alter_info::ALTER_TABLE_LOCK_NONE
|
||||
|| alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING
|
||||
|| thd->locked_tables_mode == LTM_LOCK_TABLES
|
||||
|| thd->lex->sql_command == SQLCOM_OPTIMIZE
|
||||
|| alter_info->algorithm(thd) > Alter_info::ALTER_TABLE_ALGORITHM_COPY)
|
||||
online= false;
|
||||
|
|
@ -10906,6 +10905,9 @@ do_continue:;
|
|||
goto err_new_table_cleanup;
|
||||
}
|
||||
|
||||
if (thd->locked_tables_mode == LTM_LOCK_TABLES)
|
||||
online= false;
|
||||
|
||||
// If EXCLUSIVE lock is requested, upgrade already.
|
||||
if (alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE &&
|
||||
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue