1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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.
This commit is contained in:
Sergey Vojtovich
2018-10-30 02:00:46 +04:00
committed by Monty
parent 7a9dfdd8d9
commit f1867505a6
8 changed files with 278 additions and 69 deletions

View File

@ -218,6 +218,7 @@ connection con2;
unlock tables;
connection con3;
a
connection con4;
connection default;
disconnect con5;
disconnect con4;
@ -247,6 +248,7 @@ flush table t2;
connection default;
unlock tables;
connection con1;
connection con2;
#
# LOCK TABLES .. WRITE
#
@ -299,7 +301,7 @@ connection default;
alter table t1 add column j int;
connect insert,localhost,root,,test,,;
connection insert;
insert into t1 values (1,2);;
insert into t1 values (1,2);
connection default;
unlock tables;
connection flush;