diff options
author | Monty <monty@mariadb.org> | 2018-11-06 17:05:24 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-12-09 22:12:27 +0200 |
commit | 965311ee8b2bf65e772a121a83fc35b4dd44de5e (patch) | |
tree | 8f1273b19510d912f6ef9ba5b4216ceb93ad9b3b /sql/sql_base.h | |
parent | f386b70beb5742c4b0e3afe8b34cb0897537e375 (diff) | |
download | mariadb-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/sql_base.h')
-rw-r--r-- | sql/sql_base.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h index 47ca2229af5..2b245217bce 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -57,6 +57,13 @@ enum enum_resolution_type { RESOLVED_AGAINST_ALIAS }; +/* Argument to flush_tables() of what to flush */ +enum flush_tables_type { + FLUSH_ALL, + FLUSH_NON_TRANS_TABLES, + FLUSH_SYS_TABLES +}; + enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND, IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE, IGNORE_EXCEPT_NON_UNIQUE}; @@ -291,7 +298,7 @@ void close_log_table(THD *thd, Open_tables_backup *backup); bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool wait_for_refresh, ulong timeout); void purge_tables(bool purge_flag); -bool flush_tables(THD *thd); +bool flush_tables(THD *thd, flush_tables_type flag); bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connect_string); void close_all_tables_for_name(THD *thd, TABLE_SHARE *share, ha_extra_function extra, @@ -552,14 +559,14 @@ public: Set flag indicating that we have already acquired metadata lock protecting this statement against GRL while opening tables. */ - void set_has_protection_against_grl() + void set_has_protection_against_grl(enum_mdl_type mdl_type) { - m_has_protection_against_grl= TRUE; + m_has_protection_against_grl|= MDL_BIT(mdl_type); } - bool has_protection_against_grl() const + bool has_protection_against_grl(enum_mdl_type mdl_type) const { - return m_has_protection_against_grl; + return (bool) (m_has_protection_against_grl & MDL_BIT(mdl_type)); } private: @@ -591,7 +598,7 @@ private: Indicates that in the process of opening tables we have acquired protection against global read lock. */ - bool m_has_protection_against_grl; + mdl_bitmap_t m_has_protection_against_grl; }; |