summaryrefslogtreecommitdiff
path: root/mysql-test/main/lock_multi.test
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2018-10-30 02:00:46 +0400
committerMonty <monty@mariadb.org>2018-12-09 22:12:26 +0200
commitf1867505a62bf3ecde6438cc8d3b9cae24dd5f52 (patch)
tree081c1c7ff26f094a999fa9d702e0ab5a28a73742 /mysql-test/main/lock_multi.test
parent7a9dfdd8d985040778881fe815cfca019fdd37f1 (diff)
downloadmariadb-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/lock_multi.test')
-rw-r--r--mysql-test/main/lock_multi.test22
1 files changed, 18 insertions, 4 deletions
diff --git a/mysql-test/main/lock_multi.test b/mysql-test/main/lock_multi.test
index 16845aa8acb..59c6978cb5a 100644
--- a/mysql-test/main/lock_multi.test
+++ b/mysql-test/main/lock_multi.test
@@ -392,8 +392,13 @@ let $wait_condition=
--echo # waiting for release of read lock
connection con4;
--echo # would hang and later cause a deadlock
-flush tables t2;
+--send flush tables t2
connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "flush tables t2";
+--source include/wait_condition.inc
--echo # clean up
unlock tables;
connection con2;
@@ -401,6 +406,8 @@ connection con2;
unlock tables;
connection con3;
--reap
+connection con4;
+--reap
connection default;
disconnect con5;
disconnect con4;
@@ -437,11 +444,18 @@ let $wait_condition=
--source include/wait_condition.inc
--echo # statement is waiting for release of read lock
connection con2;
-flush table t2;
+--send flush table t2
connection default;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Waiting for table metadata lock" and
+ info = "flush table t2";
+--source include/wait_condition.inc
unlock tables;
connection con1;
--reap
+connection con2;
+--reap
--echo #
--echo # LOCK TABLES .. WRITE
@@ -553,11 +567,11 @@ let $wait_condition=
where state = "Waiting for backup lock" and
info = "flush tables with read lock";
--source include/wait_condition.inc
---send insert into t1 values (1,2);
+--send insert into t1 values (1,2)
connection default;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
- where state = "Waiting for backup lock" and
+ where state = "Waiting for table metadata lock" and
info = "insert into t1 values (1,2)";
--source include/wait_condition.inc
unlock tables;