summaryrefslogtreecommitdiff
path: root/sql/sql_base.h
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2010-07-22 16:56:50 +0100
committerLuis Soares <luis.soares@sun.com>2010-07-22 16:56:50 +0100
commit9a714c935f0bfba136ed4144c7389402816c1420 (patch)
tree5a2149e9c8739b4144a1c69b624eb7bfe52e92d2 /sql/sql_base.h
parent74d67316829134f04bac656879408d4f7f2de8a4 (diff)
downloadmariadb-git-9a714c935f0bfba136ed4144c7389402816c1420.tar.gz
BUG#55387: binlog.binlog_tmp_table crashes the server
sporadically There are two problems: 1. When closing temporary tables, during the THD clean up - and after the session connection was already closed, there is a chance we can push an error into the THD diagnostics area, if the writing of the implicit DROP event to the binary log fails for some reason. As a consequence an assertion can be triggered, because at that point the diagnostics area is already set. 2. Using push_warning with MYSQL_ERROR::WARN_LEVEL_ERROR is a bug. Given that close_temporary_tables is mostly called from THD::cleanup - ie, with the session already closed, we fix problem #1 by allowing the diagnostics area to be overwritten. There is one other place in the code that calls close_temporary_tables - while applying Start_log_event_v3. To cover that case, we make close_temporary_tables to return the error, thus, propagating upwards in the stack. To fix problem #2, we replace push_warning with sql_print_error. sql/log_event.cc: Added handling of error returned by close_temporary_tables to Start_log_event_v3::do_apply_event. sql/sql_base.cc: Three changes to close_temporary_tables: 1. it returns a boolean now (instead of void) 2. it uses sql_print_error instead of push_warning when writing to binary log fails 3. we set can_overwrite_status before writing to the binary log, thence not risking triggering an assertion by any other push into diagnostics area happening inside mysql_bin_log.write. sql/sql_base.h: Changed the interface of close_temporary_tables so that it returns bool instead of void.
Diffstat (limited to 'sql/sql_base.h')
-rw-r--r--sql/sql_base.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 20a068e27d7..eed535f5cdc 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -222,7 +222,7 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables);
void free_io_cache(TABLE *entry);
void intern_close_table(TABLE *entry);
bool close_thread_table(THD *thd, TABLE **table_ptr);
-void close_temporary_tables(THD *thd);
+bool close_temporary_tables(THD *thd);
TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
bool check_alias);
int drop_temporary_table(THD *thd, TABLE_LIST *table_list);