diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-12-02 19:31:57 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-12-02 19:31:57 +0300 |
commit | 124cda8a0a783180b280935fd4b62a2b7d6dc6c4 (patch) | |
tree | c7cd519ccaa3357e48161f2c078f2e22c00d2e56 /sql/mdl.h | |
parent | e3b3907c4f6f6dbfd650272e7c65880d04e5789e (diff) | |
download | mariadb-git-124cda8a0a783180b280935fd4b62a2b7d6dc6c4.tar.gz |
Backport of:
------------------------------------------------------------
revno: 2630.4.33
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w2
timestamp: Fri 2008-06-20 17:11:20 +0400
message:
WL#3726 "DDL locking for all metadata objects".
After-review fixes in progress.
Minimized dependency of mdl.cc on other modules (particularly
made it independant of mysql_priv.h) in order to be able
write unit tests for metadata locking subsystem.
sql/ha_ndbcluster_binlog.cc:
Use newly introduced MAX_MDLKEY_LENGTH constant for allocating
buffer for object key for metadata locking subsystem.
sql/log_event.cc:
Use newly introduced MAX_MDLKEY_LENGTH constant for allocating
buffer for object key for metadata locking subsystem.
sql/mdl.cc:
Removed dependency on THD class (and thus on mysql_priv.h)
by using direct access to members of st_my_thread_var instead
of accessing THD::killed/enter_cond()/exit_cond().
sql/mdl.h:
Added MAX_MDLKEY_LENGTH constant to be used for allocating
buffers for key for metadata locking subsystem.
Added declarations of server kernel functions used by metadata
locking subsystem to mdl.h in order to decrease dependency of
mdl.cc on other files.
sql/mysql_priv.h:
Moved declaration of notify_thread_having_shared_lock() to the
mdl.h (also renamed it to make clear in metadata locking code
that it is a callback to SQL-layer).
sql/sql_base.cc:
Renamed notify_thread_having_shared_lock() to make it clear
in metadata locking subsystem code that it is a callback
to SQL layer.
sql/sql_handler.cc:
Use newly introduced MAX_MDLKEY_LENGTH constant for allocating
buffer for object key for metadata locking subsystem.
sql/sql_show.cc:
Use newly introduced MAX_MDLKEY_LENGTH constant for allocating
buffer for object key for metadata locking subsystem.
Diffstat (limited to 'sql/mdl.h')
-rw-r--r-- | sql/mdl.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/mdl.h b/sql/mdl.h index 92bd83038e5..b4b84a9ab24 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -19,6 +19,7 @@ #include "sql_plist.h" #include <my_sys.h> #include <m_string.h> +#include <mysql_com.h> class THD; @@ -148,6 +149,9 @@ void mdl_context_backup_and_reset(MDL_CONTEXT *ctx, MDL_CONTEXT *backup); void mdl_context_restore(MDL_CONTEXT *ctx, MDL_CONTEXT *backup); void mdl_context_merge(MDL_CONTEXT *target, MDL_CONTEXT *source); +/** Maximal length of key for metadata locking subsystem. */ +#define MAX_MDLKEY_LENGTH (4 + NAME_LEN + 1 + NAME_LEN + 1) + void mdl_init_lock(MDL_LOCK_DATA *lock_data, char *key, int type, const char *db, const char *name); MDL_LOCK_DATA *mdl_alloc_lock(int type, const char *db, const char *name, @@ -237,4 +241,19 @@ void* mdl_get_cached_object(MDL_LOCK_DATA *lock_data); void mdl_set_cached_object(MDL_LOCK_DATA *lock_data, void *cached_object, mdl_cached_object_release_hook release_hook); + +/* + Functions in the server's kernel used by metadata locking subsystem. +*/ + +extern bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use); +extern void mysql_ha_flush(THD *thd); +extern "C" const char *set_thd_proc_info(THD *thd, const char *info, + const char *calling_function, + const char *calling_file, + const unsigned int calling_line); +#ifndef DBUG_OFF +extern pthread_mutex_t LOCK_open; +#endif + #endif |