mtr_warnings.sql 9.79 KB
Newer Older
1
-- Copyright (c) 2008, 2011, Oracle and/or its affiliates
2 3 4 5 6 7 8 9 10 11 12 13 14
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software Foundation,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
15

16 17 18 19 20 21
delimiter ||;

use mtr||

--
-- Create table where testcases can insert patterns to
22
-- be suppressed
23
--
24
CREATE TABLE test_suppressions (
25
  pattern VARCHAR(255)
26
) ENGINE=MyISAM||
27 28 29 30 31


--
-- Declare a trigger that makes sure
-- no invalid patterns can be inserted
32
-- into test_suppressions
33
--
34 35 36 37 38 39
SET @character_set_client_saved = @@character_set_client||
SET @character_set_results_saved = @@character_set_results||
SET @collation_connection_saved = @@collation_connection||
SET @@character_set_client = latin1||
SET @@character_set_results = latin1||
SET @@collation_connection = latin1_swedish_ci||
40 41
/*!50002
CREATE DEFINER=root@localhost TRIGGER ts_insert
42
BEFORE INSERT ON test_suppressions
43 44 45 46 47
FOR EACH ROW BEGIN
  DECLARE dummy INT;
  SELECT "" REGEXP NEW.pattern INTO dummy;
END
*/||
48 49 50
SET @@character_set_client = @character_set_client_saved||
SET @@character_set_results = @character_set_results_saved||
SET @@collation_connection = @collation_connection_saved||
51 52 53


--
54
-- Load table with patterns that will be suppressed globally(always)
55
--
56
CREATE TABLE global_suppressions (
57
  pattern VARCHAR(255)
58
) ENGINE=MyISAM||
59 60 61 62


-- Declare a trigger that makes sure
-- no invalid patterns can be inserted
63
-- into global_suppressions
64
--
65 66 67 68 69 70
SET @character_set_client_saved = @@character_set_client||
SET @character_set_results_saved = @@character_set_results||
SET @collation_connection_saved = @@collation_connection||
SET @@character_set_client = latin1||
SET @@character_set_results = latin1||
SET @@collation_connection = latin1_swedish_ci||
71 72
/*!50002
CREATE DEFINER=root@localhost TRIGGER gs_insert
73
BEFORE INSERT ON global_suppressions
74 75 76 77 78
FOR EACH ROW BEGIN
  DECLARE dummy INT;
  SELECT "" REGEXP NEW.pattern INTO dummy;
END
*/||
79 80 81
SET @@character_set_client = @character_set_client_saved||
SET @@character_set_results = @character_set_results_saved||
SET @@collation_connection = @collation_connection_saved||
82 83 84 85



--
86
-- Insert patterns that should always be suppressed
87
--
88
INSERT INTO global_suppressions VALUES
89
 (".SELECT UNIX_TIMESTAMP... failed on master"),
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
 ("Aborted connection"),
 ("Client requested master to start replication from impossible position"),
 ("Could not find first log file name in binary log"),
 ("Enabling keys got errno"),
 ("Error reading master configuration"),
 ("Error reading packet"),
 ("Event Scheduler"),
 ("Failed to open log"),
 ("Failed to open the existing master info file"),
 ("Forcing shutdown of [0-9]* plugins"),

 /*
   Due to timing issues, it might be that this warning
   is printed when the server shuts down and the
   computer is loaded.
 */

 ("Got error [0-9]* when reading table"),
 ("Incorrect definition of table"),
 ("Incorrect information in file"),
 ("InnoDB: Warning: we did not need to do crash recovery"),
 ("Invalid \\(old\\?\\) table or database name"),
 ("Lock wait timeout exceeded"),
 ("Log entry on master is longer than max_allowed_packet"),
 ("unknown option '--loose-"),
 ("unknown variable 'loose-"),
 ("You have forced lower_case_table_names to 0 through a command-line option"),
 ("Setting lower_case_table_names=2"),
 ("NDB Binlog:"),
 ("NDB: failed to setup table"),
 ("NDB: only row based binary logging"),
 ("Neither --relay-log nor --relay-log-index were used"),
 ("Query partially completed"),
 ("Slave I.O thread aborted while waiting for relay log"),
 ("Slave SQL thread is stopped because UNTIL condition"),
 ("Slave SQL thread retried transaction"),
 ("Slave \\(additional info\\)"),
 ("Slave: .*Duplicate column name"),
 ("Slave: .*master may suffer from"),
 ("Slave: According to the master's version"),
 ("Slave: Column [0-9]* type mismatch"),
 ("Slave: Error .* doesn't exist"),
 ("Slave: Error .*Unknown table"),
 ("Slave: Error in Write_rows event: "),
 ("Slave: Field .* of table .* has no default value"),
 ("Slave: Field .* doesn't have a default value"),
 ("Slave: Query caused different errors on master and slave"),
 ("Slave: Table .* doesn't exist"),
 ("Slave: Table width mismatch"),
 ("Slave: The incident LOST_EVENTS occured on the master"),
 ("Slave: Unknown error.* 1105"),
 ("Slave: Can't drop database.* database doesn't exist"),
 ("Time-out in NDB"),
 ("Warning:\s+One can only use the --user.*root"),
 ("Warning:\s+Table:.* on (delete|rename)"),
 ("You have an error in your SQL syntax"),
 ("deprecated"),
 ("description of time zone"),
 ("equal MySQL server ids"),
 ("error .*connecting to master"),
 ("error reading log entry"),
 ("lower_case_table_names is set"),
 ("skip-name-resolve mode"),
 ("slave SQL thread aborted"),
 ("Slave: .*Duplicate entry"),

156
 ("Statement may not be safe to log in statement format"),
157 158

 /* innodb foreign key tests that fail in ALTER or RENAME produce this */
159
 ("InnoDB: Error: in ALTER TABLE `test`.`t[123]`"),
160
 ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
161
 ("InnoDB: Error: table `test`.`t[123]` .*does not exist in the InnoDB internal"),
162
 ("InnoDB: Warning: semaphore wait:"),
163 164 165 166 167 168 169

 /*
   BUG#32080 - Excessive warnings on Solaris: setrlimit could not
   change the size of core files
  */
 ("setrlimit could not change the size of core files to 'infinity'"),

Bjorn Munch's avatar
Bjorn Munch committed
170
 ("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."),
171

Bjorn Munch's avatar
Bjorn Munch committed
172 173 174 175 176 177 178 179 180 181 182
 /* Added 2009-08-XX after fixing Bug #42408 */

 ("Although a path was specified for the .* option, log tables are used"),
 ("Backup: Operation aborted"),
 ("Restore: Operation aborted"),
 ("Restore: The grant .* was skipped because the user does not exist"),
 ("The path specified for the variable .* is not a directory or cannot be written:"),
 ("Master server does not support or not configured semi-sync replication, fallback to asynchronous"),
 (": The MySQL server is running with the --secure-backup-file-priv option so it cannot execute this statement"),
 ("Slave: Unknown table 't1' Error_code: 1051"),

Michael Widenius's avatar
Michael Widenius committed
183 184
 /* Maria storage engine dependent tests */

Michael Widenius's avatar
Michael Widenius committed
185 186 187 188 189 190 191 192 193
 /* maria-recovery.test has warning about missing log file */
 ("File '.*maria_log.000.*' not found \\(Errcode: 2\\)"),
 /* and about marked-corrupted table */
 ("Table '..mysqltest.t_corrupted1' is crashed, skipping it. Please repair"),
 /* maria-recover.test corrupts tables on purpose */
 ("Checking table:   '..mysqltest.t_corrupted2'"),
 ("Table '..mysqltest.t_corrupted2' is marked as crashed and should be"),
 ("Incorrect key file for table '..mysqltest.t_corrupted2.MAI'"),

194 195 196 197 198 199
 /* Messages from valgrind */
 ("==[0-9]*== Memcheck,"),
 ("==[0-9]*== Copyright"),
 ("==[0-9]*== Using"),
 ("==[0-9]*== For more details"),
 /* This comes with innodb plugin tests */
200
 ("==[0-9]*== Warning: set address range perms: large range"),
201 202
 /* valgrind-3.5.0 dumps this */
 ("==[0-9]*== Command: "),
203 204 205 206 207 208

 /* valgrind warnings: invalid file descriptor -1 in syscall
    write()/read(). Bug #50414 */
 ("==[0-9]*== Warning: invalid file descriptor -1 in syscall write()"),
 ("==[0-9]*== Warning: invalid file descriptor -1 in syscall read()"),

209
 /*
210 211 212 213 214 215
   BUG#42147 - Concurrent DML and LOCK TABLE ... READ for InnoDB 
   table cause warnings in errlog
   Note: This is a temporary suppression until Bug#42147 can be 
   fixed properly. See bug page for more information.
  */
 ("Found lock of type 6 that is write and read locked"),
216

217 218 219 220 221 222 223 224
 /*
   Transient network failures that cause warnings on reconnect.
   BUG#47743 and BUG#47983.
 */
 ("Slave I/O: Get master SERVER_ID failed with error:.*"),
 ("Slave I/O: Get master clock failed with error:.*"),
 ("Slave I/O: Get master COLLATION_SERVER failed with error:.*"),
 ("Slave I/O: Get master TIME_ZONE failed with error:.*"),
225 226 227
 ("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.*"),
 ("Slave I/O: Get master BINLOG_CHECKSUM failed with error.*"),
 ("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"),
228 229 230 231 232 233 234
 ("THE_LAST_SUPPRESSION")||


--
-- Procedure that uses the above created tables to check
-- the servers error log for warnings
--
235
CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT)
236
BEGIN
237
  DECLARE `pos` bigint unsigned;
238 239 240

  -- Don't write these queries to binlog
  SET SQL_LOG_BIN=0;
241

Magnus Svensson's avatar
Magnus Svensson committed
242 243 244 245 246 247
  --
  -- Remove mark from lines that are suppressed by global suppressions
  --
  UPDATE error_log el, global_suppressions gs
    SET suspicious=0
      WHERE el.suspicious=1 AND el.line REGEXP gs.pattern;
248

Magnus Svensson's avatar
Magnus Svensson committed
249 250 251 252 253 254
  --
  -- Remove mark from lines that are suppressed by test specific suppressions
  --
  UPDATE error_log el, test_suppressions ts
    SET suspicious=0
      WHERE el.suspicious=1 AND el.line REGEXP ts.pattern;
255

Magnus Svensson's avatar
Magnus Svensson committed
256 257 258 259 260
  --
  -- Get the number of marked lines and return result
  --
  SELECT COUNT(*) INTO @num_warnings FROM error_log
    WHERE suspicious=1;
261 262

  IF @num_warnings > 0 THEN
263
    SELECT line
Magnus Svensson's avatar
Magnus Svensson committed
264
        FROM error_log WHERE suspicious=1;
265
    --SELECT * FROM test_suppressions;
266 267
    -- Return 2 -> check failed
    SELECT 2 INTO result;
268
  ELSE
269 270
    -- Return 0 -> OK
    SELECT 0 INTO RESULT;
271 272 273
  END IF;

  -- Cleanup for next test
274
  TRUNCATE test_suppressions;
Magnus Svensson's avatar
Magnus Svensson committed
275
  DROP TABLE error_log;
276 277 278 279 280

END||

--
-- Declare a procedure testcases can use to insert test
281
-- specific suppressions
282 283 284
--
/*!50001
CREATE DEFINER=root@localhost
285
PROCEDURE add_suppression(pattern VARCHAR(255))
286
BEGIN
287
  INSERT INTO test_suppressions (pattern) VALUES (pattern);
288 289 290 291
END
*/||