diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-07-01 15:53:46 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-07-01 15:53:46 +0200 |
commit | 9ff272fbbd9f8e8bb412cf8ddc12d6e97242ef63 (patch) | |
tree | c9d08724cb81d3b7ffd2f6515930d6df9e4b5bf1 /sql/mysqld.h | |
parent | 29e9130d60d79b88b9e6593a111ced4363e9225e (diff) | |
download | mariadb-git-9ff272fbbd9f8e8bb412cf8ddc12d6e97242ef63.tar.gz |
A 5.5 version of the fix for Bug #54360 "Deadlock DROP/ALTER/CREATE
DATABASE with open HANDLER"
Remove LOCK_create_db, database name locks, and use metadata locks instead.
This exposes CREATE/DROP/ALTER DATABASE statements to the graph-based
deadlock detector in MDL, and paves the way for a safe, deadlock-free
implementation of RENAME DATABASE.
Database DDL statements will now take exclusive metadata locks on
the database name, while table/view/routine DDL statements take
intention exclusive locks on the database name. This prevents race
conditions between database DDL and table/view/routine DDL.
(e.g. DROP DATABASE with concurrent CREATE/ALTER/DROP TABLE)
By adding database name locks, this patch implements
WL#4450 "DDL locking: CREATE/DROP DATABASE must use database locks" and
WL#4985 "DDL locking: namespace/hierarchical locks".
The patch also changes code to use init_one_table() where appropriate.
The new lock_table_names() function requires TABLE_LIST::db_length to
be set correctly, and this is taken care of by init_one_table().
This patch also adds a simple template to help work with
the mysys HASH data structure.
Most of the patch was written by Konstantin Osipov.
Diffstat (limited to 'sql/mysqld.h')
-rw-r--r-- | sql/mysqld.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/mysqld.h b/sql/mysqld.h index e14cd15ceb8..b07d148f507 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -234,8 +234,8 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids, key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create, key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log, key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables, - key_LOCK_lock_db, key_LOCK_logger, key_LOCK_manager, key_LOCK_mapped_file, - key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count, + key_LOCK_logger, key_LOCK_manager, key_LOCK_mapped_file, + key_LOCK_open, key_LOCK_prepared_stmt_count, key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status, key_LOCK_table_share, key_LOCK_thd_data, key_LOCK_user_conn, key_LOCK_uuid_generator, key_LOG_LOCK_log, @@ -323,7 +323,7 @@ extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded /* Server mutex locks and condition variables. */ -extern mysql_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_lock_db, +extern mysql_mutex_t LOCK_open, LOCK_mapped_file, LOCK_user_locks, LOCK_status, LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator, LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone, |