summaryrefslogtreecommitdiff
path: root/sql/lock.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-11-06 17:05:24 +0200
committerMonty <monty@mariadb.org>2018-12-09 22:12:27 +0200
commit965311ee8b2bf65e772a121a83fc35b4dd44de5e (patch)
tree8f1273b19510d912f6ef9ba5b4216ceb93ad9b3b /sql/lock.cc
parentf386b70beb5742c4b0e3afe8b34cb0897537e375 (diff)
downloadmariadb-git-965311ee8b2bf65e772a121a83fc35b4dd44de5e.tar.gz
Added new MDL_BACKUP locks for all backup stages
Part of MDEV-5336 Implement LOCK FOR BACKUP - Added new locks to MDL_BACKUP for all stages of backup locks and a new MDL lock needed for backup stages. - Renamed MDL_BACKUP_STMT to MDL_BACKUP_DDL - flush_tables() takes a new parameter that decides what should be flushed. - InnoDB, Aria (transactional tables with checksums), Blackhole, Federated and Federatedx tables are marked to be safe for online backup. We are using MDL_BACKUP_TRANS_DML instead of MDL_BACKUP_DML locks for these which allows any DML's to proceed for these tables during the whole backup process until BACKUP STAGE COMMIT which will block the final commit.
Diffstat (limited to 'sql/lock.cc')
-rw-r--r--sql/lock.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index 1103bc96f1a..f6a4ea00a33 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -863,7 +863,7 @@ bool lock_schema_name(THD *thd, const char *db)
if (thd->global_read_lock.can_acquire_protection())
return TRUE;
- global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_STMT, MDL_STATEMENT);
+ global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT);
mdl_request.init(MDL_key::SCHEMA, db, "", MDL_EXCLUSIVE, MDL_TRANSACTION);
mdl_requests.push_front(&mdl_request);
@@ -921,7 +921,7 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
if (thd->global_read_lock.can_acquire_protection())
return TRUE;
- global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_STMT, MDL_STATEMENT);
+ global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT);
schema_request.init(MDL_key::SCHEMA, db, "", MDL_INTENTION_EXCLUSIVE,
MDL_TRANSACTION);
mdl_request.init(mdl_type, db, name, MDL_EXCLUSIVE, MDL_TRANSACTION);
@@ -996,7 +996,8 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
/**
Take global read lock, wait if there is protection against lock.
- If the global read lock is already taken by this thread, then nothing is done.
+ If the global read lock is already taken by this thread, then nothing is
+ done.
Concurrent thread can acquire protection against global read lock either
before or after it got table metadata lock. This may lead to a deadlock if
@@ -1011,7 +1012,7 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
See also "Handling of global read locks" above.
- @param thd Reference to thread.
+ @param thd Reference to thread.
@retval False Success, global read lock set, commits are NOT blocked.
@retval True Failure, thread was killed.
@@ -1033,7 +1034,8 @@ bool Global_read_lock::lock_global_read_lock(THD *thd)
MDL_BACKUP_FTWRL1));
DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
MDL_BACKUP_FTWRL2));
- mdl_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_FTWRL1, MDL_EXPLICIT);
+ mdl_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_FTWRL1,
+ MDL_EXPLICIT);
do
{