summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
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
commite1c43705b9bf19e5167a2bfb5b539eb98d0197c2 (patch)
tree4c37714310115ce874f3db661cc187b3192f028a /sql/sql_class.cc
parent8f7a48ff58e16ae6ce40cb9e0beaff89d26a9564 (diff)
downloadmariadb-git-e1c43705b9bf19e5167a2bfb5b539eb98d0197c2.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())
Diffstat (limited to 'sql/sql_class.cc')
-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),