summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorGuangbao Ni <gni@mysql.com>2009-04-03 18:21:57 +0000
committerGuangbao Ni <gni@mysql.com>2009-04-03 18:21:57 +0000
commit173d29536dbf84278923ffdbbc28e49b7f393814 (patch)
treea4ba09dcb80d09a21c6824f95140e0b09b4584ff /sql
parentff9803acea8e7270e1b58f8221fbcd902580e052 (diff)
downloadmariadb-git-173d29536dbf84278923ffdbbc28e49b7f393814.tar.gz
BUG#42640 mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLESmode)
Mysql server crashes because unsafe statements warning is wrongly elevated to error, which is set the error status of Diagnostics_area of the thread in THD::binlog_query(). Yet the caller believes that binary logging shouldn't touch the status, so it will set the status also later by my_ok(), my_error() or my_message() seperately according to the execution result of the statement or transaction. But the status of Diagnostics_area of the thread is allowed to set only once. Fixed to clear the error wrongly set by binary logging, but keep the warning message. mysql-test/suite/binlog/r/binlog_stm_ps.result: Change unsafe warning to NOTE level mysql-test/suite/binlog/r/binlog_unsafe.result: Test case result for unsafe statements to ensure mysql sever don't crash mysql-test/suite/binlog/t/binlog_unsafe.test: Test case for unsafe statements to ensure mysql sever don't crash mysql-test/suite/rpl/r/rpl_skip_error.result: Change unsafe warning to NOTE level mysql-test/suite/rpl/r/rpl_stm_loadfile.result: Change unsafe warning to NOTE level mysql-test/suite/rpl/r/rpl_udf.result: Change unsafe warning to NOTE level sql/sql_class.cc: the error status of the thread is cleared When a warning is elevated to an error because of unsafe warning of binary log.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_class.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7f15508caa1..b73822f5a48 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -3676,7 +3676,11 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
if (sql_log_bin_toplevel && lex->is_stmt_unsafe() &&
variables.binlog_format == BINLOG_FORMAT_STMT)
{
- push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN,
+ /*
+ A warning can be elevated a error when STRICT sql mode.
+ But we don't want to elevate binlog warning to error here.
+ */
+ push_warning(this, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BINLOG_UNSAFE_STATEMENT,
ER(ER_BINLOG_UNSAFE_STATEMENT));
if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))