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/lock.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/lock.cc')
-rw-r--r-- | sql/lock.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/lock.cc b/sql/lock.cc index f6a4ea00a33..1564059bb20 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -861,7 +861,7 @@ bool lock_schema_name(THD *thd, const char *db) return TRUE; } - if (thd->global_read_lock.can_acquire_protection()) + if (thd->has_read_only_protection()) return TRUE; global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT); mdl_request.init(MDL_key::SCHEMA, db, "", MDL_EXCLUSIVE, MDL_TRANSACTION); @@ -919,7 +919,7 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type, DBUG_ASSERT(name); DEBUG_SYNC(thd, "before_wait_locked_pname"); - if (thd->global_read_lock.can_acquire_protection()) + if (thd->has_read_only_protection()) return TRUE; global_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DDL, MDL_STATEMENT); schema_request.init(MDL_key::SCHEMA, db, "", MDL_INTENTION_EXCLUSIVE, @@ -1028,6 +1028,12 @@ bool Global_read_lock::lock_global_read_lock(THD *thd) MDL_request mdl_request; bool result; + if (thd->current_backup_stage != BACKUP_FINISHED) + { + my_error(ER_BACKUP_LOCK_IS_ACTIVE, MYF(0)); + DBUG_RETURN(1); + } + mysql_ha_cleanup_no_free(thd); DBUG_ASSERT(! thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "", |