1 # name : log_warnings_suppress.patch
2 # introduced : 11 or before
6 # Any small change to this file in the main branch
7 # should be done or reviewed by the maintainer!
9 +++ b/patch_info/log_warnings_suppress.patch
11 +File=log_warnings_suppress.patch
12 +Name=Disable log warnings for enumerated warnings (old name:suppress_log_warning_1592.patch)
14 +Author=Percona <info@percona.com>
18 +2011-01-05 rename patch suppress_log_warning_1592.patch to log_warnings_silence.patch. Also remove boolean system variable "suppress_log_warning_1592" and add set varbile "log_warnings_silence" (possible values: 1592)
19 +2011-02-21 rename patch log_warning_silence.patch to log_warnings_suppress.patch. Also rename variable "log_warning_silence" to "log_warning_suppress".
23 SHOW_COMP_OPTION have_crypt, have_compress;
24 SHOW_COMP_OPTION have_profiling;
26 +ulonglong opt_log_warnings_suppress= 0;
28 /* Thread specific variables */
30 pthread_key(MEM_ROOT**,THR_MALLOC);
34 extern TYPELIB thread_handling_typelib;
35 extern my_decimal decimal_zero;
37 +extern ulonglong opt_log_warnings_suppress;
40 THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
41 using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
42 --- a/sql/sql_class.cc
43 +++ b/sql/sql_class.cc
45 ER_BINLOG_UNSAFE_STATEMENT,
46 ER(ER_BINLOG_UNSAFE_STATEMENT),
47 ER(LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
48 - if (global_system_variables.log_warnings)
49 + if (global_system_variables.log_warnings && ((opt_log_warnings_suppress & (ULL(1) << log_warnings_suppress_1592)) == 0))
51 char buf[MYSQL_ERRMSG_SIZE * 2];
52 sprintf(buf, ER(ER_BINLOG_UNSAFE_STATEMENT),
56 SLOG_F_TMP_TABLE, SLOG_F_TMP_DISK, SLOG_F_FILESORT,
59 +enum enum_log_warnings_suppress { log_warnings_suppress_1592 };
60 enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
61 SLAVE_EXEC_MODE_IDEMPOTENT,
62 SLAVE_EXEC_MODE_LAST_BIT};
65 @@ -1572,6 +1572,15 @@
66 READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'),
67 VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
69 +const char *log_warnings_suppress_name[]= { "1592" };
70 +static Sys_var_set Sys_log_warnings_suppress(
71 + "log_warnings_suppress",
72 + "disable logging of enumerated warnings: "
73 + "1592: unsafe statements for binary logging; "
74 + "possible values : [1592]",
75 + GLOBAL_VAR(opt_log_warnings_suppress), CMD_LINE(REQUIRED_ARG),
76 + log_warnings_suppress_name, DEFAULT(0));
78 static Sys_var_ulong Sys_preload_buff_size(
79 "preload_buffer_size",
80 "The size of the buffer that is allocated when preloading indexes",
82 +++ b/mysql-test/r/percona_log_warnings_suppress.result
84 +SET @old_log_warnings = @@log_warnings;
85 +SET @old_log_warnings_suppress = @@log_warnings_suppress;
86 +DROP TABLE IF EXISTS t1;
87 +CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
88 +SET GLOBAL log_warnings_suppress='';
89 +SET GLOBAL LOG_WARNINGS=0;
90 +SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
92 +log_warnings_suppress
93 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
95 +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
96 +SET GLOBAL LOG_WARNINGS=1;
97 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
99 +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
100 +SET GLOBAL log_warnings_suppress='1592';
101 +SET GLOBAL LOG_WARNINGS=0;
102 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
104 +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
105 +SET GLOBAL LOG_WARNINGS=1;
106 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
108 +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
110 +SET GLOBAL log_warnings = @old_log_warnings;
111 +SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress;
112 +# Count the number of times the "Unsafe" message was printed
116 +++ b/mysql-test/t/percona_log_warnings_suppress-master.opt
120 +++ b/mysql-test/t/percona_log_warnings_suppress.test
122 +-- source include/have_log_bin.inc
123 +-- source include/have_binlog_format_statement.inc
125 +SET @old_log_warnings = @@log_warnings;
126 +SET @old_log_warnings_suppress = @@log_warnings_suppress;
129 +DROP TABLE IF EXISTS t1;
131 +CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(20));
132 +SET GLOBAL log_warnings_suppress='';
133 +SET GLOBAL LOG_WARNINGS=0;
134 +SHOW GLOBAL VARIABLES LIKE 'log_warnings_suppress';
135 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
136 +SET GLOBAL LOG_WARNINGS=1;
137 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
138 +SET GLOBAL log_warnings_suppress='1592';
139 +SET GLOBAL LOG_WARNINGS=0;
140 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
141 +SET GLOBAL LOG_WARNINGS=1;
142 +INSERT INTO t1 VALUES(UUID(), 'suppress_1592');
145 +SET GLOBAL log_warnings = @old_log_warnings;
146 +SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress;
148 +let $log_error_= `SELECT @@GLOBAL.log_error`;
149 +if(!`select LENGTH('$log_error_')`)
151 + # MySQL Server on windows is started with --console and thus
152 + # does not know the location of its .err log, use default location
153 + let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
155 +# Assign env variable LOG_ERROR
156 +let LOG_ERROR=$log_error_;
158 +--echo # Count the number of times the "Unsafe" message was printed
159 +--echo # to the error log.
163 + my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
164 + open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
165 + my $count = () = grep(/suppress_1592/g,<FILE>);
166 + print "Occurrences: $count\n";
169 --- a/mysql-test/r/mysqld--help-notwin.result
170 +++ b/mysql-test/r/mysqld--help-notwin.result
172 --log-tc-size=# Size of transaction coordinator log.
173 -W, --log-warnings[=#]
174 Log some not critical warnings to the log file
175 + --log-warnings-suppress=name
176 + disable logging of enumerated warnings: 1592: unsafe
177 + statements for binary logging; possible values : [1592]
178 --long-query-time=# Log all queries that have taken more than long_query_time
179 seconds to execute to file. The argument will be treated
180 as a decimal value with microsecond precision
185 +log-warnings-suppress
187 low-priority-updates FALSE
188 lower-case-table-names 1