diff options
author | unknown <petr/cps@owlet.local> | 2006-10-24 17:00:23 +0400 |
---|---|---|
committer | unknown <petr/cps@owlet.local> | 2006-10-24 17:00:23 +0400 |
commit | 5aa81b561e9d1604533c37498c471cd853fb72a5 (patch) | |
tree | 2b7e93bbe62a86d3dc9de1c82450398a83d59e1a /sql/log.h | |
parent | 66b872805cbd542c6012eef7141443d95a697f7d (diff) | |
parent | 9438b9851901c48f8e280c2665f9469c2f998c2f (diff) | |
download | mariadb-git-5aa81b561e9d1604533c37498c471cd853fb72a5.tar.gz |
Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into mysql.com:/home/cps/mysql/devel/5.1-rename-bug
mysql-test/r/log_tables.result:
Auto merged
mysql-test/t/log_tables.test:
Auto merged
sql/handler.cc:
Auto merged
sql/handler.h:
Auto merged
sql/log.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_rename.cc:
Auto merged
sql/table.cc:
Auto merged
storage/csv/ha_tina.cc:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
sql/log.cc:
manual merge
sql/share/errmsg.txt:
manual merge
sql/sql_table.cc:
manual merge
Diffstat (limited to 'sql/log.h')
-rw-r--r-- | sql/log.h | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/sql/log.h b/sql/log.h index 8f75601f02b..f39b52f5db2 100644 --- a/sql/log.h +++ b/sql/log.h @@ -404,6 +404,9 @@ public: }; +int check_if_log_table(uint db_len, const char *db, uint table_name_len, + const char *table_name, uint check_if_opened); + class Log_to_csv_event_handler: public Log_event_handler { /* @@ -412,6 +415,16 @@ class Log_to_csv_event_handler: public Log_event_handler THD's of the query. The reason is the locking order and duration. */ THD *general_log_thd, *slow_log_thd; + /* + This is for the thread, which called tmp_close_log_tables. The thread + will be allowed to write-lock the log tables (as it explicitly disabled + logging). This is used for such operations as REPAIR, which require + exclusive lock on the log tables. + NOTE: there can be only one priviliged thread, as one should + lock logger with logger.lock() before calling tmp_close_log_tables(). + So no other thread could get privileged status at the same time. + */ + THD *privileged_thread; friend class LOGGER; TABLE_LIST general_log, slow_log; @@ -436,13 +449,20 @@ public: const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len, CHARSET_INFO *client_cs); - bool flush(THD *thd, TABLE_LIST *close_slow_Log, - TABLE_LIST* close_general_log); + void tmp_close_log_tables(THD *thd); void close_log_table(uint log_type, bool lock_in_use); bool reopen_log_table(uint log_type); + THD* get_privileged_thread() + { + return privileged_thread; + } }; +/* type of the log table */ +#define QUERY_LOG_SLOW 1 +#define QUERY_LOG_GENERAL 2 + class Log_to_file_event_handler: public Log_event_handler { MYSQL_QUERY_LOG mysql_log; @@ -498,13 +518,18 @@ public: {} void lock() { (void) pthread_mutex_lock(&LOCK_logger); } void unlock() { (void) pthread_mutex_unlock(&LOCK_logger); } - bool is_general_log_table_enabled() + void tmp_close_log_tables(THD *thd); + bool is_log_table_enabled(uint log_table_type) { - return table_log_handler && table_log_handler->general_log.table != 0; - } - bool is_slow_log_table_enabled() - { - return table_log_handler && table_log_handler->slow_log.table != 0; + switch (log_table_type) { + case QUERY_LOG_SLOW: + return table_log_handler && table_log_handler->slow_log.table != 0; + case QUERY_LOG_GENERAL: + return table_log_handler && table_log_handler->general_log.table != 0; + default: + DBUG_ASSERT(0); + return FALSE; /* make compiler happy */ + } } /* We want to initialize all log mutexes as soon as possible, @@ -542,6 +567,7 @@ public: void close_log_table(uint log_type, bool lock_in_use); bool reopen_log_table(uint log_type); + bool reopen_log_tables(); /* we use this function to setup all enabled log event handlers */ int set_handlers(uint error_log_printer, @@ -564,6 +590,13 @@ public: return file_log_handler->get_mysql_log(); return NULL; } + THD* get_privileged_thread() + { + if (table_log_handler) + return table_log_handler->get_privileged_thread(); + else + return NULL; + } }; enum enum_binlog_format { |