Debian Codegraph @

mysql-test/suite/ndb_rpl/t/show_mysqld_warnings.inc

raw
1 # ==== Purpose ====
2 #
3 #
4 # Shows relevant messages in the MySQLd log output of a server. The
5 # messages are loaded from a specific server, $server_num. They are then
6 # filtered by the specified $pattern and can be limited in scope (to
7 # avoid repetitions). The relevant messages can be trimmed by a regex
8 # expression.
9 #
10 # ==== Usage ====
11 # --let $server_num= 1.1
12 # --let $pattern=%an interesting message%
13 # --let $limit=1
14 # [--let $replace_expr=/message/warning//]
15 #
16 # Parameters:
17 # $server_num
18 # The server number from where the messages are to be loaded
19 #
20 # $pattern
21 # The pattern of the relevant messages
22 #
23 # $limit
24 # Limits the output to this value
25 #
26 # $replace_expr
27 # Replaces the output using this regex
28
29
30 --disable_query_log
31 --echo MySQLD error output for server $server_num matching pattern $pattern
32 create table errlog (a int auto_increment primary key, txt text) engine=myisam;
33
34 # Avoid win path separators being interpreted as escapes
35 # for next char by having no escape char
36 --eval load data local infile "$MYSQLTEST_VARDIR/log/mysqld.$server_num.err" into table errlog columns terminated by '\n' escaped by '' (txt);
37
38 --eval delete from errlog where txt not like '$pattern';
39 # Trim time, win CRs and fix win path separators (or any other backslashes)
40 update errlog set txt= replace(replace( lower( right(txt, length(txt) - locate('[',txt) + 1)), '\r', ''), '\\', '/');
41 # Remove error id added as part of WL#11009: Logging services: log writers: add error ID to traditional error log
42 # This id is of no interest to us so it is trimmed from the output. The string functions assume that there are
43 # only two pairs of [] used in the log messages
44 update errlog set txt= concat(trim(substring_index(txt, '[', 2)),substring_index(txt, ']', -1));
45
46 if ($replace_expr)
47 {
48 --replace_regex $replace_expr
49 }
50 --eval select txt as relevant from errlog order by a desc limit $limit
51
52 # Cleanup
53 --let $replace_expr=
54 drop table errlog;
55 --enable_query_log