1create database mtr; 2create database test; 3delimiter ||; 4 5use mtr|| 6 7-- 8-- Create table where testcases can insert patterns to 9-- be suppressed 10-- 11CREATE TABLE test_suppressions ( 12 pattern VARCHAR(255) 13) ENGINE=MyISAM|| 14 15 16-- 17-- Declare a trigger that makes sure 18-- no invalid patterns can be inserted 19-- into test_suppressions 20-- 21SET @character_set_client_saved = @@character_set_client|| 22SET @character_set_results_saved = @@character_set_results|| 23SET @collation_connection_saved = @@collation_connection|| 24SET @@character_set_client = latin1|| 25SET @@character_set_results = latin1|| 26SET @@collation_connection = latin1_swedish_ci|| 27/*!50002 28CREATE DEFINER=root@localhost TRIGGER ts_insert 29BEFORE INSERT ON test_suppressions 30FOR EACH ROW BEGIN 31 DECLARE dummy INT; 32 SELECT "" REGEXP NEW.pattern INTO dummy; 33END 34*/|| 35SET @@character_set_client = @character_set_client_saved|| 36SET @@character_set_results = @character_set_results_saved|| 37SET @@collation_connection = @collation_connection_saved|| 38 39 40-- 41-- Load table with patterns that will be suppressed globally(always) 42-- 43CREATE TABLE global_suppressions ( 44 pattern VARCHAR(255) 45) ENGINE=MyISAM|| 46 47 48-- Declare a trigger that makes sure 49-- no invalid patterns can be inserted 50-- into global_suppressions 51-- 52SET @character_set_client_saved = @@character_set_client|| 53SET @character_set_results_saved = @@character_set_results|| 54SET @collation_connection_saved = @@collation_connection|| 55SET @@character_set_client = latin1|| 56SET @@character_set_results = latin1|| 57SET @@collation_connection = latin1_swedish_ci|| 58/*!50002 59CREATE DEFINER=root@localhost TRIGGER gs_insert 60BEFORE INSERT ON global_suppressions 61FOR EACH ROW BEGIN 62 DECLARE dummy INT; 63 SELECT "" REGEXP NEW.pattern INTO dummy; 64END 65*/|| 66SET @@character_set_client = @character_set_client_saved|| 67SET @@character_set_results = @character_set_results_saved|| 68SET @@collation_connection = @collation_connection_saved|| 69 70 71 72-- 73-- Insert patterns that should always be suppressed 74-- 75INSERT INTO global_suppressions VALUES 76 (".SELECT UNIX_TIMESTAMP... failed on master"), 77 ("Aborted connection"), 78 ("Client requested master to start replication from position"), 79 ("Could not find first log file name in binary log"), 80 ("Enabling keys got errno"), 81 ("Error reading master configuration"), 82 ("Error reading packet"), 83 ("Event Scheduler"), 84 ("Failed to open log"), 85 ("Failed to open the existing master info file"), 86 ("Forcing shutdown of [0-9]* plugins"), 87 ("Forcing close of thread"), 88 89 ("innodb-page-size has been changed"), 90 91 /* 92 Due to timing issues, it might be that this warning 93 is printed when the server shuts down and the 94 computer is loaded. 95 */ 96 97 ("Got error [0-9]* when reading table"), 98 ("Incorrect definition of table"), 99 ("Incorrect information in file"), 100 ("InnoDB: Warning: we did not need to do crash recovery"), 101 ("Invalid \\(old\\?\\) table or database name"), 102 ("Lock wait timeout exceeded"), 103 ("Log entry on master is longer than max_allowed_packet"), 104 ("unknown option '--loose-"), 105 ("unknown variable 'loose-"), 106 ("You have forced lower_case_table_names to 0 through a command-line option"), 107 ("Setting lower_case_table_names=2"), 108 ("NDB Binlog:"), 109 ("NDB: failed to setup table"), 110 ("NDB: only row based binary logging"), 111 ("Neither --relay-log nor --relay-log-index were used"), 112 ("Query partially completed"), 113 ("Slave I.O thread aborted while waiting for relay log"), 114 ("Slave SQL thread is stopped because UNTIL condition"), 115 ("Slave SQL thread retried transaction"), 116 ("Slave \\(additional info\\)"), 117 ("Slave: .*Duplicate column name"), 118 ("Slave: .*master may suffer from"), 119 ("Slave: According to the master's version"), 120 ("Slave: Column [0-9]* type mismatch"), 121 ("Slave: Error .* doesn't exist"), 122 ("Slave: Error .*Unknown table"), 123 ("Slave: Error in Write_rows event: "), 124 ("Slave: Field .* of table .* has no default value"), 125 ("Slave: Field .* doesn't have a default value"), 126 ("Slave: Query caused different errors on master and slave"), 127 ("Slave: Table .* doesn't exist"), 128 ("Slave: Table width mismatch"), 129 ("Slave: The incident LOST_EVENTS occured on the master"), 130 ("Slave: Unknown error.* 1105"), 131 ("Slave: Can't drop database.* database doesn't exist"), 132 ("Sort aborted"), 133 ("Time-out in NDB"), 134 ("Warning:\s+One can only use the --user.*root"), 135 ("Warning:\s+Table:.* on (delete|rename)"), 136 ("You have an error in your SQL syntax"), 137 ("deprecated"), 138 ("description of time zone"), 139 ("equal MySQL server ids"), 140 ("error .*connecting to master"), 141 ("error reading log entry"), 142 ("lower_case_table_names is set"), 143 ("skip-name-resolve mode"), 144 ("slave SQL thread aborted"), 145 ("Slave: .*Duplicate entry"), 146 147 ("Statement may not be safe to log in statement format"), 148 149 /* innodb foreign key tests that fail in ALTER or RENAME produce this */ 150 ("InnoDB: Error: in ALTER TABLE `test`.`t[123]`"), 151 ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"), 152 ("InnoDB: Error: table `test`.`t[123]` does not exist in the InnoDB internal"), 153 154 /* 155 BUG#32080 - Excessive warnings on Solaris: setrlimit could not 156 change the size of core files 157 */ 158 ("setrlimit could not change the size of core files to 'infinity'"), 159 160 ("The slave I.O thread stops because a fatal error is encountered when it tries to get the value of SERVER_UUID variable from master.*"), 161 ("The initialization command '.*' failed with the following error.*"), 162 163 /*It will print a warning if a new UUID of server is generated.*/ 164 ("No existing UUID has been found, so we assume that this is the first time that this server has been started.*"), 165 /*It will print a warning if server is run without --explicit_defaults_for_timestamp.*/ 166 ("TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details)*"), 167 /*It will print a warning if a server is run without NO_AUTO_CREATE_USER sql mode.*/ 168 ("'NO_AUTO_CREATE_USER' sql mode was not set."), 169 170 /* Added 2009-08-XX after fixing Bug #42408 */ 171 172 ("Although a path was specified for the --general-log-file option, log tables are used"), 173 ("Although a path was specified for the --slow-query-log-file option, log tables are used"), 174 ("Backup: Operation aborted"), 175 ("Restore: Operation aborted"), 176 ("Restore: The grant .* was skipped because the user does not exist"), 177 ("The path specified for the variable .* is not a directory or cannot be written:"), 178 ("Master server does not support or not configured semi-sync replication, fallback to asynchronous"), 179 (": The MySQL server is running with the --secure-backup-file-priv option so it cannot execute this statement"), 180 ("Slave: Unknown table 'test.t1' Error_code: 1051"), 181 182 /* Messages from valgrind */ 183 ("==[0-9]*== Memcheck,"), 184 ("==[0-9]*== Copyright"), 185 ("==[0-9]*== Using"), 186 ("==[0-9]*== For more details"), 187 /* This comes with innodb plugin tests */ 188 ("==[0-9]*== Warning: set address range perms: large range"), 189 /* valgrind-3.5.0 dumps this */ 190 ("==[0-9]*== Command: "), 191 192 /* valgrind warnings: invalid file descriptor -1 in syscall 193 write()/read(). Bug #50414 */ 194 ("==[0-9]*== Warning: invalid file descriptor -1 in syscall write()"), 195 ("==[0-9]*== Warning: invalid file descriptor -1 in syscall read()"), 196 197 /* 198 Transient network failures that cause warnings on reconnect. 199 BUG#47743 and BUG#47983. 200 */ 201 ("Slave I/O: Get master SERVER_UUID failed with error:.*"), 202 ("Slave I/O: Get master SERVER_ID failed with error:.*"), 203 ("Slave I/O: Get master clock failed with error:.*"), 204 ("Slave I/O: Get master COLLATION_SERVER failed with error:.*"), 205 ("Slave I/O: Get master TIME_ZONE failed with error:.*"), 206 ("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum on master.*"), 207 ("Slave I/O: Get master BINLOG_CHECKSUM failed with error.*"), 208 ("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"), 209 /* 210 BUG#42147 - Concurrent DML and LOCK TABLE ... READ for InnoDB 211 table cause warnings in errlog 212 Note: This is a temporary suppression until Bug#42147 can be 213 fixed properly. See bug page for more information. 214 */ 215 ("Found lock of type 6 that is write and read locked"), 216 217 /* 218 Warning message is printed out whenever a slave is started with 219 a configuration that is not crash-safe. 220 */ 221 (".*If a crash happens this configuration does not guarantee.*"), 222 223 /* 224 Warning messages introduced in the context of the WL#4143. 225 */ 226 ("Storing MySQL user name or password information in the master.info repository is not secure.*"), 227 ("Sending passwords in plain text without SSL/TLS is extremely insecure."), 228 229 /* 230 In MTS if the user issues a stop slave sql while it is scheduling a group 231 of events, this warning is emitted. 232 */ 233 ("Slave SQL: Coordinator thread of multi-threaded slave is being stopped in the middle of assigning a group of events.*"), 234 235 ("Changed limits: max_open_files: *"), 236 ("Changed limits: max_connections: *"), 237 ("Changed limits: table_open_cache: *"), 238 ("Could not increase number of max_open_files to more than *"), 239 240 ("THE_LAST_SUPPRESSION")|| 241 242 243-- 244-- Procedure that uses the above created tables to check 245-- the servers error log for warnings 246-- 247CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT) 248BEGIN 249 DECLARE `pos` bigint unsigned; 250 251 -- Don't write these queries to binlog 252 SET SQL_LOG_BIN=0; 253 254 -- 255 -- Remove mark from lines that are suppressed by global suppressions 256 -- 257 UPDATE error_log el, global_suppressions gs 258 SET suspicious=0 259 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; 260 261 -- 262 -- Remove mark from lines that are suppressed by test specific suppressions 263 -- 264 UPDATE error_log el, test_suppressions ts 265 SET suspicious=0 266 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; 267 268 -- 269 -- Get the number of marked lines and return result 270 -- 271 SELECT COUNT(*) INTO @num_warnings FROM error_log 272 WHERE suspicious=1; 273 274 IF @num_warnings > 0 THEN 275 SELECT line 276 FROM error_log WHERE suspicious=1; 277 --SELECT * FROM test_suppressions; 278 -- Return 2 -> check failed 279 SELECT 2 INTO result; 280 ELSE 281 -- Return 0 -> OK 282 SELECT 0 INTO RESULT; 283 END IF; 284 285 -- Cleanup for next test 286 TRUNCATE test_suppressions; 287 DROP TABLE error_log; 288 289END|| 290 291-- 292-- Declare a procedure testcases can use to insert test 293-- specific suppressions 294-- 295CREATE DEFINER=root@localhost 296PROCEDURE add_suppression(pattern VARCHAR(255)) 297BEGIN 298 INSERT INTO test_suppressions (pattern) VALUES (pattern); 299END 300|| 301 302 303