mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-27962 Instant DDL downgrades the MDL when table is empty
- Server incorrectly downgrading the MDL after prepare phase when
table is empty. mdl_exclusive_after_prepare is being set in
prepare phase only. But mdl_exclusive_after_prepare condition was
misplaced and checked before prepare phase by
commit d270525dfd
and it is now
changed to check after prepare phase.
- main.innodb_mysql_sync test case was changed to avoid locking
optimization when table is empty.
This commit is contained in:
@ -7716,16 +7716,15 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
lock for prepare phase under LOCK TABLES in the same way as when
|
||||
exclusive lock is required for duration of the whole statement.
|
||||
*/
|
||||
if (!ha_alter_info->mdl_exclusive_after_prepare &&
|
||||
(inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK ||
|
||||
((inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK ||
|
||||
if (inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK ||
|
||||
((inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK ||
|
||||
inplace_supported == HA_ALTER_INPLACE_COPY_LOCK ||
|
||||
inplace_supported == HA_ALTER_INPLACE_NOCOPY_NO_LOCK ||
|
||||
inplace_supported == HA_ALTER_INPLACE_NOCOPY_LOCK ||
|
||||
inplace_supported == HA_ALTER_INPLACE_INSTANT) &&
|
||||
(thd->locked_tables_mode == LTM_LOCK_TABLES ||
|
||||
thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES)) ||
|
||||
alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE))
|
||||
alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE)
|
||||
{
|
||||
if (wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
|
||||
goto cleanup;
|
||||
@ -7822,7 +7821,8 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
necessary only for prepare phase (unless we are not under LOCK TABLES) and
|
||||
user has not explicitly requested exclusive lock.
|
||||
*/
|
||||
if ((inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK ||
|
||||
if (!ha_alter_info->mdl_exclusive_after_prepare &&
|
||||
(inplace_supported == HA_ALTER_INPLACE_COPY_NO_LOCK ||
|
||||
inplace_supported == HA_ALTER_INPLACE_COPY_LOCK ||
|
||||
inplace_supported == HA_ALTER_INPLACE_NOCOPY_LOCK ||
|
||||
inplace_supported == HA_ALTER_INPLACE_NOCOPY_NO_LOCK) &&
|
||||
|
Reference in New Issue
Block a user