mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Moved early check for table existance to mysql_execute_command()
MDEV-17772 - 3 way lock : ALTER, MDL, BACKUP STAGE BLOCK_DDL While waiting for a (potentially long) RO transaction or SELECT, DDL and LOCK TABLES ... WRITE hold protection against FTWRL and BACKUP STAGE. This effectively makes FTWRL/BACKUP STAGE indirectly wait for this RO transaction or SELECT to finish. Which is not great, as otherwise we could do something useful meanwhile. With this patch BACKUP lock is attempted to be acquired after TABLE/SCHEMA locks. If this attempt fails, TABLE/SCHEMA locks gets released and we start waiting for BACKUP lock. When wait finishes, BACKUP lock is released (to avoid deadlocks) and we attempt to acquire all locks once again. Other changes: - Take MDL lock before testing if table exists as part of CREATE TABLE ... IF EXISTS. This change was an effect of changes in lock_table_name and removes an inconsistency where one could get different error messages from CREATE TABLE .. IF EXISTS depending on active mdl locks. One effect of this change is that we don't binary log CREATE TABLE IF EXISTS if the table exists. This was done because old code was sometimes behaving inconsistenly (it was logged some time and not other times) and sending the query to the slave could make the slave even more inconsistent as there is not guarantee that the new table will have the same definition as the old table on the master.
This commit is contained in:
@ -142,8 +142,7 @@ let $wait_condition=
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
SET STATEMENT lock_wait_timeout=0 FOR SELECT * FROM t1;
|
||||
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
SET STATEMENT lock_wait_timeout=0 FOR backup stage block_ddl;
|
||||
backup stage block_ddl;
|
||||
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
|
||||
backup stage end;
|
||||
|
||||
@ -195,15 +194,10 @@ SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1;
|
||||
connection con2;
|
||||
backup stage start;
|
||||
backup stage flush;
|
||||
--send backup stage block_ddl
|
||||
backup stage block_ddl;
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Waiting for backup lock";
|
||||
--source include/wait_condition.inc
|
||||
commit;
|
||||
connection con2;
|
||||
--reap
|
||||
backup stage end;
|
||||
connection con1;
|
||||
--reap # DROP TABLE
|
||||
|
Reference in New Issue
Block a user