summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-07-31 10:00:35 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-07-31 10:00:35 -0300
commit7d8b967a86f077754ad74cee6aff0543984beba4 (patch)
tree4c37714310115ce874f3db661cc187b3192f028a /sql
parent88780b03b916e98ad9116f1db0c380078ebc78af (diff)
downloadmariadb-git-7d8b967a86f077754ad74cee6aff0543984beba4.tar.gz
Bug#46265: Can not disable warning about unsafe statements for binary logging
If using statement based replication (SBR), repeatedly calling statements which are unsafe for SBR will cause a warning message to be written to the error for each statement. This might lead to filling up the error log and there is no way to disable this behavior. The solution is to only log these message (about statements unsafe for statement based replication) if the log_warnings option is set. For example: SET GLOBAL LOG_WARNINGS = 0; INSERT INTO t1 VALUES(UUID()); SET GLOBAL LOG_WARNINGS = 1; INSERT INTO t1 VALUES(UUID()); In this case the message will be printed only once: [Warning] Statement may not be safe to log in statement format. Statement: INSERT INTO t1 VALUES(UUID()) mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result: Add test case result for Bug#46265 mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt: Make log_error value available. mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test: Add test case for Bug#46265 sql/sql_class.cc: Print warning only if the log_warnings is enabled.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_class.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 54684e4987e..9db86214a6b 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -3714,7 +3714,8 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
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))
+ if (global_system_variables.log_warnings &&
+ !(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
{
sql_print_warning("%s Statement: %.*s",
ER(ER_BINLOG_UNSAFE_STATEMENT),