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.
Showing
Please register or sign in to comment