diff options
author | Monty <monty@mariadb.org> | 2018-11-13 01:34:37 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-12-09 22:12:27 +0200 |
commit | c53aab974bef7d98810409029d996e89677d2f68 (patch) | |
tree | 5ea7b1ed09f9b85802d8093e38b9193812cb4a87 /sql/sql_base.cc | |
parent | 965311ee8b2bf65e772a121a83fc35b4dd44de5e (diff) | |
download | mariadb-git-c53aab974bef7d98810409029d996e89677d2f68.tar.gz |
Added syntax and implementation for BACKUP STAGE's
Part of MDEV-5336 Implement LOCK FOR BACKUP
- Changed check of Global_only_lock to also include BACKUP lock.
- We store latest MDL_BACKUP_DDL lock in thd->mdl_backup_ticket to be able
to downgrade lock during copy_data_between_tables()
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d6b9e967f63..45dea349af4 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2100,7 +2100,7 @@ retry_share: MDL_request protection_request; MDL_deadlock_handler mdl_deadlock_handler(ot_ctx); - if (thd->global_read_lock.can_acquire_protection()) + if (thd->has_read_only_protection()) { MYSQL_UNBIND_TABLE(table->file); tc_release_table(table); @@ -3978,7 +3978,7 @@ lock_table_names(THD *thd, const DDL_options_st &options, by acquiring global intention exclusive lock with statement duration. */ - if (thd->global_read_lock.can_acquire_protection()) + if (thd->has_read_only_protection()) DBUG_RETURN(TRUE); global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT); @@ -3997,6 +3997,8 @@ lock_table_names(THD *thd, const DDL_options_st &options, if (create_table) thd->push_internal_handler(&error_handler); // Avoid warnings & errors bool res= thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout); + if (!(flags & MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK)) + thd->mdl_backup_ticket= global_request.ticket; if (create_table) thd->pop_internal_handler(); if (!res) |