1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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.


mysql-test/extra/binlog_tests/binlog.test:
  Add test to verify this patch.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Add test to verify this patch.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Add test to verify this patch.
sql/sql_binlog.cc:
  Add code to backup and restore thd->options.
This commit is contained in:
unknown
2010-11-28 17:43:36 +08:00
parent 7197f142cc
commit f225470b39
4 changed files with 179 additions and 0 deletions

View File

@ -50,6 +50,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;