Debian Codegraph @

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

raw
1 #
2 # Verify that the wsrep XID gets updated in InnoDB rollback segment
3 # properly and can be recovered with --wsrep-recover
4 #
5 # The test runs the following scenarios:
6 #
7 # 1) The server is started but no SQL is run
8 # 2) DDL is executed
9 # 3) INSERT is executed
10 # 4) Two INSERTs are executed so that the first one in order will be
11 # blocked after certification and the second one before entering
12 # commit order critical section.
13 # 5) Two DMLs are executed so that the prepare step is run out of order.
14 # Both transactions are blocked before commit order critical section.
15 #
16 # After each scenario server is killed and the recovered position
17 # is validated.
18 #
19
20 --source include/have_wsrep.inc
21 --source include/have_innodb.inc
22 --source include/have_wsrep_provider.inc
23 --source include/have_debug_sync.inc
24
25 #
26 # Binlog option for recovery run. This must be set in the test because
27 # combinations file causes log-bin option to be set from command line,
28 # not via my.cnf.
29 #
30 --let $log_bin = `SELECT @@log_bin`
31 if ($log_bin) {
32 --let $wsrep_recover_binlog_opt = --log-bin
33 }
34
35 #
36 # Scenario 1
37 # The expected recovered seqno is 1 corresponding to initial cluster
38 # configuration change.
39 #
40 let $restart_noprint=2;
41
42 --source include/kill_mysqld.inc
43 --source wsrep-recover-step.inc
44 --echo Expect seqno 1
45 --echo $wsrep_recover_start_position_seqno
46
47 --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
48 --source include/start_mysqld.inc
49 --source include/wait_wsrep_ready.inc
50
51 #
52 # Senario 2
53 # The expected recovered seqno is 3 corresponding to two configuration
54 # changes and CREATE TABLE
55 #
56
57 CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
58 let $restart_noprint=2;
59 --source include/kill_mysqld.inc
60 --source wsrep-recover-step.inc
61 --echo Expect seqno 3
62 --echo $wsrep_recover_start_position_seqno
63
64 --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
65 --source include/start_mysqld.inc
66 --source include/wait_wsrep_ready.inc
67
68 #
69 # Scenario 3
70 # The expected recovered seqno is 5 corresponding to three configuration
71 # changes, CREATE TABLE and INSERT.
72 #
73 # The expected wsrep_last_committed after the server is restarted is 6.
74 #
75
76 INSERT INTO t1 VALUES (5);
77 let $restart_noprint=2;
78 --source include/kill_mysqld.inc
79 --source wsrep-recover-step.inc
80 --echo Expect seqno 5
81 --echo $wsrep_recover_start_position_seqno
82 --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
83 --source include/start_mysqld.inc
84 --source include/wait_wsrep_ready.inc
85
86 SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
87
88 #
89 # Scenario 4
90 #
91 # The INSERT gets prepared but not committed.
92 #
93 # This scenario is not applicable if binlog is not on since the
94 # commit is not 2PC.
95 #
96 # If binlog is on, the INSERT
97 # should be rolled back during recovery phase since it has not yet
98 # been logged into binlog.
99 #
100 if ($log_bin) {
101 --connect con1, localhost, root
102 SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue";
103 --send INSERT INTO t1 VALUES (7)
104
105 --connection default
106 let $restart_noprint=2;
107 SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached";
108 --source include/kill_mysqld.inc
109 --source wsrep-recover-step.inc
110 --echo Expect seqno 6
111 --echo $wsrep_recover_start_position_seqno
112 --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
113 --source include/start_mysqld.inc
114 --source include/wait_wsrep_ready.inc
115 --echo Expect 5
116 SELECT * FROM t1;
117 }
118
119 DROP TABLE t1;