summaryrefslogtreecommitdiff
path: root/sql/sql_binlog.cc
diff options
context:
space:
mode:
author <Li-Bing.Song@sun.com>2010-11-28 17:43:36 +0800
committer <Li-Bing.Song@sun.com>2010-11-28 17:43:36 +0800
commitabb201c131a6ea390e3f9974a603e43742c73445 (patch)
treee2c18432d8e8890623628e2e9b7a6e6624f56e7b /sql/sql_binlog.cc
parent86a4cf1116a28ca10708e271a5a7b3f6eaf55722 (diff)
downloadmariadb-git-abb201c131a6ea390e3f9974a603e43742c73445.tar.gz
BUG#54903 BINLOG statement toggles session variables
When using BINLOG statement to execute rows log events, session variables foreign_key_checks and unique_checks are changed temporarily. As each rows log event has their own special session environment and its own foreign_key_checks and unique_checks can be different from current session which executing the BINLOG statement. But these variables are not restored correctly after BINLOG statement. This problem will cause that the following statements fail or generate unexpected data. In this patch, code is added to backup and restore these two variables. So BINLOG statement will not affect current session's variables again.
Diffstat (limited to 'sql/sql_binlog.cc')
-rw-r--r--sql/sql_binlog.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index 82de6feb1a9..31fd2de3722 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -51,6 +51,13 @@ void mysql_client_binlog_statement(THD* thd)
size_t decoded_len= base64_needed_decoded_length(coded_len);
/*
+ thd->options will be changed when applying the event. But we don't expect
+ it be changed permanently after BINLOG statement, so backup it first.
+ It will be restored at the end of this function.
+ */
+ ulonglong thd_options= thd->options;
+
+ /*
Allocation
*/
@@ -236,6 +243,7 @@ void mysql_client_binlog_statement(THD* thd)
my_ok(thd);
end:
+ thd->options= thd_options;
rli->clear_tables_to_lock();
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
DBUG_VOID_RETURN;