diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2018-10-30 02:00:46 +0400 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-12-09 22:12:26 +0200 |
commit | f1867505a62bf3ecde6438cc8d3b9cae24dd5f52 (patch) | |
tree | 081c1c7ff26f094a999fa9d702e0ab5a28a73742 /mysql-test/main/mdl_sync.result | |
parent | 7a9dfdd8d985040778881fe815cfca019fdd37f1 (diff) | |
download | mariadb-git-f1867505a62bf3ecde6438cc8d3b9cae24dd5f52.tar.gz |
Acquire global read lock (MDL_BACKUP_STMT) after share is acquired
Part of MDEV-5336 Implement LOCK FOR BACKUP
FLUSH TABLE table_names have changed slighty as we are now opening
tables before taking the MDL lock. The difference is that FLUSH TABLE
table_name will now be blocked by a table that is waiting for FTWRL.
There should not be any new deadlocks as part of this change.
The end result is still better in most cases as FTWRL is now only
waiting for write statements to end, not for read only statements and
it's not flushing tables in use from the table cache.
Share will be needed to be able to determine if table supports online
backup. Appropriate metadata lock type in BACKUP namespace will be
acquired basing on this information.
Also made pending global read lock request to be preferred victim of MDL
deadlock detector. This allows us to hide some non-fatal deadlocks and
make FTWRL less likely to break concurrent queries.
Diffstat (limited to 'mysql-test/main/mdl_sync.result')
-rw-r--r-- | mysql-test/main/mdl_sync.result | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/mysql-test/main/mdl_sync.result b/mysql-test/main/mdl_sync.result index 7e90720dca5..f5268e557ab 100644 --- a/mysql-test/main/mdl_sync.result +++ b/mysql-test/main/mdl_sync.result @@ -3082,3 +3082,72 @@ connection default; SET debug_sync='RESET'; DROP TABLE t1; disconnect con1; +# +# MDEV-5336 - Implement LOCK FOR BACKUP +# +# Make sure deadlock detector prefers FTWRL connection as a victim +# and FTWRL retries lock attempt. This deadlock was present before +# MDEV-5336. +CREATE TABLE t1(a INT) ENGINE=InnoDB; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +BEGIN; +SELECT * FROM t2; +a +# +connect con1,localhost,root,,; +SET DEBUG_SYNC='mdl_acquire_lock_wait SIGNAL waiting'; +LOCK TABLES t2 WRITE; +# +connect con2,localhost,root,,; +SET DEBUG_SYNC='now WAIT_FOR waiting'; +SET DEBUG_SYNC='mdl_acquire_lock_wait SIGNAL waiting'; +FLUSH TABLES WITH READ LOCK; +# +connection default; +SET DEBUG_SYNC='now WAIT_FOR waiting'; +INSERT INTO t1 VALUES(1); +COMMIT; +connection con1; +UNLOCK TABLES; +connection con2; +UNLOCK TABLES; +connection default; +DROP TABLE t1, t2; +SET DEBUG_SYNC='RESET'; +disconnect con1; +disconnect con2; +# Make sure deadlock detector prefers FTWRL connection as a victim +# and FTWRL retries lock attempt. This deadlock was found during +# MDEV-5336 review. +CREATE TABLE t1(a INT) ENGINE=InnoDB; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +BEGIN; +INSERT INTO t2 VALUES(1); +SET DEBUG_SYNC='after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR go'; +INSERT INTO t1 VALUES(1); +# +connect con1,localhost,root,,; +SET DEBUG_SYNC='now WAIT_FOR table_opened'; +SET DEBUG_SYNC='mdl_acquire_lock_wait SIGNAL waiting'; +LOCK TABLES t1 WRITE; +# +connect con2,localhost,root,,; +SET DEBUG_SYNC='now WAIT_FOR waiting'; +SET DEBUG_SYNC='mdl_acquire_lock_wait SIGNAL waiting'; +FLUSH TABLES WITH READ LOCK; +# +connect con3,localhost,root,,; +SET DEBUG_SYNC='now WAIT_FOR waiting'; +SET DEBUG_SYNC='now SIGNAL go'; +connection default; +COMMIT; +connection con1; +UNLOCK TABLES; +connection con2; +UNLOCK TABLES; +connection default; +DROP TABLE t1, t2; +SET DEBUG_SYNC='RESET'; +disconnect con1; +disconnect con2; +disconnect con3; |