Debian Codegraph @

mysql-test/suite/wsrep/t/wsrep-recover-gtid.test

raw
1 # Test wsrep recovery with gtid_mode=ON. The test crashes the server
2 # in different commit stages and verifies that the GTID returned by
3 # SELECT WSREP_LAST_SEEN_GTID() and @@GLOBAL.gtid_binlog_pos get
4 # initialized properly during server restart.
5 #
6 --source include/have_wsrep.inc
7 --source include/have_wsrep_provider.inc
8 --source include/have_innodb.inc
9 --source include/have_log_bin.inc
10 --source include/have_debug_sync.inc
11
12 CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
13
14 --echo # Case 1: Server goes through graceful shutdown and is restarted
15 --connection default
16 INSERT INTO t1 VALUES (1);
17 --source include/shutdown_mysqld.inc
18 --let $galera_wsrep_recover_server_id = 1
19 --source suite/galera/include/galera_wsrep_recover.inc
20 --source suite/galera/include/start_mysqld.inc
21
22 --echo Expect 100-10-2
23 SELECT WSREP_LAST_SEEN_GTID();
24 SELECT @@GLOBAL.gtid_binlog_pos;
25 SELECT * FROM t1;
26
27 --echo # Case 2: Server is killed after the transaction gets prepared
28 --echo # but before it is written into binlog. As there is not GTID assigned,
29 --echo # the transaction must be rolled back during recovery.
30 --connect con, localhost, root
31 SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL reached WAIT_FOR continue";
32 --send INSERT INTO t1 VALUES (2)
33
34 --connection default
35 SET DEBUG_SYNC = "now WAIT_FOR reached";
36 --source include/kill_mysqld.inc
37 --let $galera_wsrep_recover_server_id = 1
38 --source suite/galera/include/galera_wsrep_recover.inc
39 --source suite/galera/include/start_mysqld.inc
40 --source include/wait_wsrep_ready.inc
41
42 --echo Expect 100-10-2
43 SELECT WSREP_LAST_SEEN_GTID();
44 SELECT @@GLOBAL.gtid_binlog_pos;
45 --echo Expect 1
46 SELECT * FROM t1;
47 --disconnect con
48
49 --echo # Case 3: Server is killed after the transaction gets written into binlog
50 --echo # but before it is committed in storage engine. In this case the
51 --echo # transaction must be committed during recovery as it had a valid
52 --echo # GTID assigned.
53
54 --connect con, localhost, root
55 SET DEBUG_SYNC = "commit_before_get_LOCK_commit_ordered SIGNAL reached WAIT_FOR continue";
56 --send INSERT INTO t1 VALUES (3)
57
58 --connection default
59 SET DEBUG_SYNC = "now WAIT_FOR reached";
60 --source include/kill_mysqld.inc
61 --let $galera_wsrep_recover_server_id = 1
62 --source suite/galera/include/galera_wsrep_recover.inc
63 --source suite/galera/include/start_mysqld.inc
64 --source include/wait_wsrep_ready.inc
65 --echo Expect 100-10-3
66 SELECT WSREP_LAST_SEEN_GTID();
67 SELECT @@GLOBAL.gtid_binlog_pos;
68 --echo Expect 1 3
69 SELECT * FROM t1;
70
71 --disconnect con
72
73 DROP TABLE t1;