diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2018-12-06 19:23:24 +0400 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-12-09 22:12:28 +0200 |
commit | 8cf7e3459d7309ce122824146260c4aecfa6ca77 (patch) | |
tree | 845a4269cf31cc0b169fb56d1765f690f3bc61f7 /mysql-test/main/backup_lock_debug.result | |
parent | c0ca164b1ce48ec8bf9b95c95c94ba62dde1f29a (diff) | |
download | mariadb-git-8cf7e3459d7309ce122824146260c4aecfa6ca77.tar.gz |
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.
Diffstat (limited to 'mysql-test/main/backup_lock_debug.result')
-rw-r--r-- | mysql-test/main/backup_lock_debug.result | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/main/backup_lock_debug.result b/mysql-test/main/backup_lock_debug.result new file mode 100644 index 00000000000..8832d9cd3e7 --- /dev/null +++ b/mysql-test/main/backup_lock_debug.result @@ -0,0 +1,28 @@ +# +# Make sure pending LOCK TABLES doesn't block BACKUP STAGE +# +CREATE TABLE t1(a INT); +LOCK TABLE t1 READ; +# +connect con1,localhost,root,,; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready'; +LOCK TABLE t1 WRITE; +# +connect con2,localhost,root,,; +SET DEBUG_SYNC= 'now WAIT_FOR ready'; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +disconnect con2; +# +connection default; +UNLOCK TABLES; +# +connection con1; +UNLOCK TABLES; +disconnect con1; +# +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; |