1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Monty
2018-11-06 17:05:24 +02:00
parent f386b70beb
commit 965311ee8b
25 changed files with 574 additions and 126 deletions

View File

@ -250,7 +250,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
tmp_write_to_binlog= 0;
if (thd->global_read_lock.lock_global_read_lock(thd))
return 1; // Killed
if (flush_tables(thd))
if (flush_tables(thd, FLUSH_ALL))
{
/*
NOTE: my_error() has been already called by reopen_tables() within
@ -273,7 +273,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
make_global_read_lock_block_commit(thd) above since they could have
modified the tables too.
*/
if (WSREP(thd) && flush_tables(thd))
if (WSREP(thd) && flush_tables(thd, FLUSH_ALL))
result= 1;
}
else
@ -309,7 +309,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
*/
if (thd->open_tables &&
!thd->mdl_context.is_lock_owner(MDL_key::BACKUP, "", "",
MDL_BACKUP_STMT))
MDL_BACKUP_DDL))
{
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),
thd->open_tables->s->table_name.str);