diff options
author | Luis Soares <luis.soares@oracle.com> | 2010-11-30 16:55:28 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@oracle.com> | 2010-11-30 16:55:28 +0000 |
commit | 23636330c96cfc158881393cd1a99bcc069cd75f (patch) | |
tree | c1675bcc173229b22b01e5ca694e83e7d84568ed /sql/log.cc | |
parent | 5094555e53707babd62057c9ba637f79cc8e29e9 (diff) | |
download | mariadb-git-23636330c96cfc158881393cd1a99bcc069cd75f.tar.gz |
BUG#57288: binlog_tmp_table fails sporadically: "Failed to write
the DROP statement ..."
Problem: When using temporary tables and closing a session, an
implicit DROP TEMPORARY TABLE IF EXISTS is written to the binary
log (while cleaning up the context of the session THD - see:
sql_class.cc:THD::cleanup which calls close_temporary_tables).
close_temporary_tables, first checks if the binary log is opened
and then proceeds to creating the DROP statements. Then, such
statements, are written to the binary log through
MYSQL_BIN_LOG::write(Log_event *). Inside, there is another check
if the binary log is opened and if not an error is returned. This
is where the faulty behavior is triggered. Given that the test
case replays a binary log, with temp tables statements, and right
after it issues RESET MASTER, there is a chance that is_open will
report false (when the mysql session is closed and the temporary
tables are written).
is_open may return false, because MYSQL_BIN_LOG::reset_logs is
not setting the correct flag (LOG_CLOSE_TO_BE_OPENED), on the
MYSQL_LOG_BIN::log_state (instead it sets just the
LOG_CLOSE_INDEX flag, leaving the log_state to
LOG_CLOSED). Thence, when writing the DROP statement as part of
the THD::cleanup, the thread could get a return value of false
for is_open - inside MYSQL_BIN_LOG::write, ultimately reporting
that it can't write the event to the binary log.
Fix: We fix this by adding the correct flag, missing in the
second close.
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc index 38f4677f06f..cff69b4cf51 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3037,7 +3037,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) } /* Start logging with a new file */ - close(LOG_CLOSE_INDEX); + close(LOG_CLOSE_INDEX | LOG_CLOSE_TO_BE_OPENED); if ((error= my_delete_allow_opened(index_file_name, MYF(0)))) // Reset (open will update) { if (my_errno == ENOENT) |