summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorLuis Soares <luis.soares@sun.com>2010-03-03 12:16:18 +0000
committerLuis Soares <luis.soares@sun.com>2010-03-03 12:16:18 +0000
commit24f7afe7bcb1befec02f7c6efe884229bda3ff39 (patch)
tree8e561fa1ca9dac0f617a071a83c130162c9a2e59 /sql/sql_base.cc
parent780566d4c5491f51cd9d058a8a2294462e3c5bbe (diff)
downloadmariadb-git-24f7afe7bcb1befec02f7c6efe884229bda3ff39.tar.gz
BUG#51226: mysqlbinlog replay: ERROR 1146 when using temp tables
+ failing statements Implicit DROP event for temporary table is not getting LOG_EVENT_THREAD_SPECIFIC_F flag, because, in the previous executed statement in the same thread, which might even be a failed statement, the thread_specific_used flag is set to FALSE (in mysql_reset_thd_for_next_command) and not set to TRUE before connection is shutdown. This means that implicit DROP event will take the FALSE value from thread_specific_used and will not set LOG_EVENT_THREAD_SPECIFIC_F in the event header. As a consequence, mysqlbinlog will not print the pseudo_thread_id from the DROP event, because one of the requirements for the printout is that this flag is set to TRUE. We fix this by setting thread_specific_used whenever we are binlogging a DROP in close_temporary_tables, and resetting it to its previous value afterward.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 06e4b1d3e63..9256d3d907f 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1515,6 +1515,7 @@ void close_temporary_tables(THD *thd)
{
if (is_user_table(table))
{
+ bool save_thread_specific_used= thd->thread_specific_used;
my_thread_id save_pseudo_thread_id= thd->variables.pseudo_thread_id;
/* Set pseudo_thread_id to be that of the processed table */
thd->variables.pseudo_thread_id= tmpkeyval(thd, table);
@@ -1544,6 +1545,7 @@ void close_temporary_tables(THD *thd)
thd->clear_error();
CHARSET_INFO *cs_save= thd->variables.character_set_client;
thd->variables.character_set_client= system_charset_info;
+ thd->thread_specific_used= TRUE;
Query_log_event qinfo(thd, s_query.ptr(),
s_query.length() - 1 /* to remove trailing ',' */,
0, FALSE, 0);
@@ -1556,6 +1558,7 @@ void close_temporary_tables(THD *thd)
"Failed to write the DROP statement for temporary tables to binary log");
}
thd->variables.pseudo_thread_id= save_pseudo_thread_id;
+ thd->thread_specific_used= save_thread_specific_used;
}
else
{