File: binlog_gtid_index_crash.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (66 lines) | stat: -rw-r--r-- 2,183 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--source include/have_innodb.inc
# Don't test this under valgrind, memory leaks will occur
--source include/not_valgrind.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
# Binary must be compiled with debug for crash to occur
--source include/have_debug.inc
--source include/have_binlog_format_row.inc

# We have an .opt file that sets a small page size and disables sparseness,
# so we get something non-trivial in the GTID index even with a small amount
# of binlogged events.

--echo *** Test that binlog GTID index is recovered after a crash.
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;

--disable_query_log
INSERT INTO t1 VALUES (0, 0);
INSERT INTO t1 VALUES (1, 0);
INSERT INTO t1 VALUES (2, 0);
--let $i= 10
while ($i < 20) {
  eval INSERT INTO t1 VALUES ($i, 0);
  inc $i;
}
--let $file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $pos1= query_get_value(SHOW MASTER STATUS, Position, 1)
--let $gtid1= `SELECT @@gtid_binlog_pos`
while ($i < 30) {
  eval INSERT INTO t1 VALUES ($i, 0);
  inc $i;
}
--let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1)
--let $gtid2= `SELECT @@gtid_binlog_pos`
while ($i < 40) {
  eval INSERT INTO t1 VALUES ($i, 0);
  inc $i;
}
--let $pos3= query_get_value(SHOW MASTER STATUS, Position, 1)
--let $gtid3= `SELECT @@gtid_binlog_pos`
INSERT INTO t1 VALUES (50, 0);
INSERT INTO t1 VALUES (51, 0);

--disable_ps2_protocol
FLUSH NO_WRITE_TO_BINLOG STATUS;
eval SELECT BINLOG_GTID_POS('$file', $pos1) = "$gtid1" AS Ok;
eval SELECT BINLOG_GTID_POS('$file', $pos2) = "$gtid2" AS Ok;
eval SELECT BINLOG_GTID_POS('$file', $pos3) = "$gtid3" AS Ok;
--enable_query_log
SHOW STATUS LIKE 'binlog_gtid_index_%';
--enable_ps2_protocol

--echo *** Crash the server, check that GTID index can be used after restart.
--source include/crash_mysqld.inc

--disable_ps2_protocol
FLUSH NO_WRITE_TO_BINLOG STATUS;
--disable_query_log
eval SELECT BINLOG_GTID_POS('$file', $pos1) = "$gtid1" AS Ok;
eval SELECT BINLOG_GTID_POS('$file', $pos2) = "$gtid2" AS Ok;
eval SELECT BINLOG_GTID_POS('$file', $pos3) = "$gtid3" AS Ok;
--enable_query_log
SHOW STATUS LIKE 'binlog_gtid_index_%';
--enable_ps2_protocol

DROP TABLE t1;