Debian Codegraph @

mysql-test/suite/binlog/t/binlog_gtid_index_crash.test

raw
1 --source include/have_innodb.inc
2 # Don't test this under valgrind, memory leaks will occur
3 --source include/not_valgrind.inc
4 # Avoid CrashReporter popup on Mac
5 --source include/not_crashrep.inc
6 # Binary must be compiled with debug for crash to occur
7 --source include/have_debug.inc
8 --source include/have_binlog_format_row.inc
9
10 # We have an .opt file that sets a small page size and disables sparseness,
11 # so we get something non-trivial in the GTID index even with a small amount
12 # of binlogged events.
13
14 --echo *** Test that binlog GTID index is recovered after a crash.
15 CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
16
17 --disable_query_log
18 INSERT INTO t1 VALUES (0, 0);
19 INSERT INTO t1 VALUES (1, 0);
20 INSERT INTO t1 VALUES (2, 0);
21 --let $i= 10
22 while ($i < 20) {
23 eval INSERT INTO t1 VALUES ($i, 0);
24 inc $i;
25 }
26 --let $file= query_get_value(SHOW MASTER STATUS, File, 1)
27 --let $pos1= query_get_value(SHOW MASTER STATUS, Position, 1)
28 --let $gtid1= `SELECT @@gtid_binlog_pos`
29 while ($i < 30) {
30 eval INSERT INTO t1 VALUES ($i, 0);
31 inc $i;
32 }
33 --let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1)
34 --let $gtid2= `SELECT @@gtid_binlog_pos`
35 while ($i < 40) {
36 eval INSERT INTO t1 VALUES ($i, 0);
37 inc $i;
38 }
39 --let $pos3= query_get_value(SHOW MASTER STATUS, Position, 1)
40 --let $gtid3= `SELECT @@gtid_binlog_pos`
41 INSERT INTO t1 VALUES (50, 0);
42 INSERT INTO t1 VALUES (51, 0);
43
44 --disable_ps2_protocol
45 FLUSH NO_WRITE_TO_BINLOG STATUS;
46 eval SELECT BINLOG_GTID_POS('$file', $pos1) = "$gtid1" AS Ok;
47 eval SELECT BINLOG_GTID_POS('$file', $pos2) = "$gtid2" AS Ok;
48 eval SELECT BINLOG_GTID_POS('$file', $pos3) = "$gtid3" AS Ok;
49 --enable_query_log
50 SHOW STATUS LIKE 'binlog_gtid_index_%';
51 --enable_ps2_protocol
52
53 --echo *** Crash the server, check that GTID index can be used after restart.
54 --source include/crash_mysqld.inc
55
56 --disable_ps2_protocol
57 FLUSH NO_WRITE_TO_BINLOG STATUS;
58 --disable_query_log
59 eval SELECT BINLOG_GTID_POS('$file', $pos1) = "$gtid1" AS Ok;
60 eval SELECT BINLOG_GTID_POS('$file', $pos2) = "$gtid2" AS Ok;
61 eval SELECT BINLOG_GTID_POS('$file', $pos3) = "$gtid3" AS Ok;
62 --enable_query_log
63 SHOW STATUS LIKE 'binlog_gtid_index_%';
64 --enable_ps2_protocol
65
66 DROP TABLE t1;