]>
Commit | Line | Data |
---|---|---|
a9ee80b9 ER |
1 | # name : log_warnings_suppress.patch |
2 | # introduced : 11 or before | |
3 | # maintainer : Oleg | |
4 | # | |
5 | #!!! notice !!! | |
6 | # Any small change to this file in the main branch | |
7 | # should be done or reviewed by the maintainer! | |
db82db79 AM |
8 | --- /dev/null |
9 | +++ b/patch_info/log_warnings_suppress.patch | |
a9ee80b9 ER |
10 | @@ -0,0 +1,9 @@ |
11 | +File=log_warnings_suppress.patch | |
12 | +Name=Disable log warnings for enumerated warnings (old name:suppress_log_warning_1592.patch) | |
13 | +Version=1.0 | |
14 | +Author=Percona <info@percona.com> | |
15 | +License=GPL | |
16 | +Comment= | |
17 | +Changelog | |
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". | |
db82db79 AM |
20 | --- a/sql/mysqld.cc |
21 | +++ b/sql/mysqld.cc | |
29ffd636 | 22 | @@ -632,6 +632,8 @@ |
a9ee80b9 ER |
23 | SHOW_COMP_OPTION have_crypt, have_compress; |
24 | SHOW_COMP_OPTION have_profiling; | |
25 | ||
26 | +ulonglong opt_log_warnings_suppress= 0; | |
27 | + | |
28 | /* Thread specific variables */ | |
29 | ||
30 | pthread_key(MEM_ROOT**,THR_MALLOC); | |
db82db79 AM |
31 | --- a/sql/mysqld.h |
32 | +++ b/sql/mysqld.h | |
29ffd636 | 33 | @@ -229,6 +229,8 @@ |
a9ee80b9 ER |
34 | extern TYPELIB thread_handling_typelib; |
35 | extern my_decimal decimal_zero; | |
36 | ||
37 | +extern ulonglong opt_log_warnings_suppress; | |
38 | + | |
db82db79 AM |
39 | /* |
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 | |
29ffd636 | 44 | @@ -5029,7 +5029,7 @@ |
a9ee80b9 ER |
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)) | |
50 | { | |
51 | char buf[MYSQL_ERRMSG_SIZE * 2]; | |
52 | sprintf(buf, ER(ER_BINLOG_UNSAFE_STATEMENT), | |
db82db79 AM |
53 | --- a/sql/sql_class.h |
54 | +++ b/sql/sql_class.h | |
1bfc1981 | 55 | @@ -87,6 +87,7 @@ |
a9ee80b9 ER |
56 | SLOG_F_TMP_TABLE, SLOG_F_TMP_DISK, SLOG_F_FILESORT, |
57 | SLOG_F_FILESORT_DISK | |
58 | }; | |
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}; | |
db82db79 AM |
63 | --- a/sql/sys_vars.cc |
64 | +++ b/sql/sys_vars.cc | |
29ffd636 | 65 | @@ -1572,6 +1572,15 @@ |
a9ee80b9 ER |
66 | READ_ONLY GLOBAL_VAR(mysqld_port), CMD_LINE(REQUIRED_ARG, 'P'), |
67 | VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1)); | |
68 | ||
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)); | |
77 | + | |
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", | |
48b678b4 AM |
81 | --- /dev/null |
82 | +++ b/mysql-test/r/percona_log_warnings_suppress.result | |
83 | @@ -0,0 +1,31 @@ | |
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'; | |
91 | +Variable_name Value | |
92 | +log_warnings_suppress | |
93 | +INSERT INTO t1 VALUES(UUID(), 'suppress_1592'); | |
94 | +Warnings: | |
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'); | |
98 | +Warnings: | |
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'); | |
103 | +Warnings: | |
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'); | |
107 | +Warnings: | |
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. | |
109 | +DROP TABLE t1; | |
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 | |
113 | +# to the error log. | |
114 | +Occurrences: 1 | |
115 | --- /dev/null | |
116 | +++ b/mysql-test/t/percona_log_warnings_suppress-master.opt | |
117 | @@ -0,0 +1 @@ | |
118 | +--log-error | |
119 | --- /dev/null | |
120 | +++ b/mysql-test/t/percona_log_warnings_suppress.test | |
121 | @@ -0,0 +1,47 @@ | |
122 | +-- source include/have_log_bin.inc | |
123 | +-- source include/have_binlog_format_statement.inc | |
124 | + | |
125 | +SET @old_log_warnings = @@log_warnings; | |
126 | +SET @old_log_warnings_suppress = @@log_warnings_suppress; | |
127 | + | |
128 | +--disable_warnings | |
129 | +DROP TABLE IF EXISTS t1; | |
130 | +--enable_warnings | |
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'); | |
143 | +DROP TABLE t1; | |
144 | + | |
145 | +SET GLOBAL log_warnings = @old_log_warnings; | |
146 | +SET GLOBAL log_warnings_suppress = @old_log_warnings_suppress; | |
147 | + | |
148 | +let $log_error_= `SELECT @@GLOBAL.log_error`; | |
149 | +if(!`select LENGTH('$log_error_')`) | |
150 | +{ | |
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; | |
154 | +} | |
155 | +# Assign env variable LOG_ERROR | |
156 | +let LOG_ERROR=$log_error_; | |
157 | + | |
158 | +--echo # Count the number of times the "Unsafe" message was printed | |
159 | +--echo # to the error log. | |
160 | + | |
161 | +perl; | |
162 | + use strict; | |
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"; | |
167 | + close(FILE); | |
168 | +EOF | |
734d6226 AM |
169 | --- a/mysql-test/r/mysqld--help-notwin.result |
170 | +++ b/mysql-test/r/mysqld--help-notwin.result | |
171 | @@ -281,6 +281,9 @@ | |
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 | |
1bfc1981 | 181 | @@ -865,6 +868,7 @@ |
734d6226 AM |
182 | log-tc tc.log |
183 | log-tc-size 24576 | |
184 | log-warnings 1 | |
185 | +log-warnings-suppress | |
186 | long-query-time 10 | |
187 | low-priority-updates FALSE | |
188 | lower-case-table-names 1 |