Debian Codegraph @

mysql-test/suite/binlog/include/binlog_incident.inc

raw
1 #
2 # This include file is used by more than one test suite
3 # (currently rpl and binlog_encryption).
4 # Please check all dependent tests after modifying it
5 #
6 # Usage:
7 #
8 # --let $use_remote_mysqlbinlog= 1 # optional
9 # --let $binlog_start_pos= <binlog position> # optional
10 # --let $binlog_file= <binlog filename> # optional
11 #
12 # --source suite/binlog/include/binlog_incident.inc
13 #
14 # The script uses MYSQLBINLOG to verify certain results.
15 # By default, it uses binary logs directly. If it is undesirable,
16 # this behavior can be overridden by setting $use_remote_binlog
17 # as shown above.
18 #
19 # All values will be unset after every execution of the script,
20 # so if they are needed, they should be set explicitly before each call.
21 #
22
23 # The purpose of this test is to provide a reference for how the
24 # incident log event is represented in the output from the mysqlbinlog
25 # program.
26
27 source include/have_log_bin.inc;
28 source include/have_debug.inc;
29 source include/binlog_start_pos.inc;
30
31 let $MYSQLD_DATADIR= `select @@datadir`;
32 RESET MASTER;
33
34 CREATE TABLE t1 (a INT);
35
36 INSERT INTO t1 VALUES (1),(2),(3);
37 SELECT * FROM t1;
38
39 # This will generate an incident log event and store it in the binary
40 # log before the replace statement.
41 REPLACE INTO t1 VALUES (4);
42
43 DROP TABLE t1;
44 FLUSH LOGS;
45
46 if ($binlog_start_pos)
47 {
48 --let $startpos= --start-position=$binlog_start_pos
49 --let $binlog_start_pos=
50 }
51 --let $filename= master-bin.000001
52 if ($binlog_file)
53 {
54 --let $filename= $binlog_file
55 --let $binlog_file=
56 }
57 --let $mysqlbinlog_args= $MYSQLD_DATADIR/$filename
58 if ($use_remote_mysqlbinlog)
59 {
60 --let $mysqlbinlog_args= --read-from-remote-server --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT -uroot $filename
61 --let $use_remote_mysqlbinlog= 0
62 }
63 exec $MYSQL_BINLOG $startpos $mysqlbinlog_args >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;
64 --disable_query_log
65 eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl;
66 --enable_query_log
67
68 remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql;