From 965311ee8b2bf65e772a121a83fc35b4dd44de5e Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 6 Nov 2018 17:05:24 +0200 Subject: 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. --- sql/sql_insert.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sql/sql_insert.cc') diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index fb4c5309b23..c741400b741 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -550,7 +550,7 @@ bool open_and_lock_for_insert_delayed(THD *thd, TABLE_LIST *table_list) if (thd->global_read_lock.can_acquire_protection()) DBUG_RETURN(TRUE); - protection_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_STMT, + protection_request.init(MDL_key::BACKUP, "", "", MDL_BACKUP_DML, MDL_STATEMENT); if (thd->mdl_context.acquire_lock(&protection_request, @@ -2374,9 +2374,12 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request, di->table_list.alias.str= di->table_list.table_name.str= di->thd.query(); di->table_list.alias.length= di->table_list.table_name.length= di->thd.query_length(); di->table_list.db= di->thd.db; - /* We need the tickets so that they can be cloned in handle_delayed_insert */ + /* + We need the tickets so that they can be cloned in + handle_delayed_insert + */ di->grl_protection.init(MDL_key::BACKUP, "", "", - MDL_BACKUP_STMT, MDL_STATEMENT); + MDL_BACKUP_DML, MDL_STATEMENT); di->grl_protection.ticket= grl_protection_request->ticket; init_mdl_requests(&di->table_list); di->table_list.mdl_request.ticket= table_list->mdl_request.ticket; -- cgit v1.2.1