Debian Codegraph @

mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test

raw
1 #
2 # Check that wsrep position is updated in innodb after
3 # a local certification failure.
4 #
5
6 --source include/galera_cluster.inc
7 --source include/have_debug_sync.inc
8
9 --let $node_1=node_1
10 --let $node_2=node_2
11 --source include/auto_increment_offset_save.inc
12
13 #
14 # Cause a certification failure. The INSERT on node_2 will fail certification,
15 # and it is going to be the last event before shutting down node_2.
16 #
17 --connection node_2
18 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
19 SET GLOBAL wsrep_slave_threads = 2;
20 SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
21
22 --let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
23
24 --connection node_1
25 --send INSERT INTO t1 VALUES (1, 'node_1');
26
27 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
28 --connection node_2a
29 SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
30
31 --connection node_2
32 SET SESSION wsrep_sync_wait = 0;
33 SET SESSION wsrep_retry_autocommit = 0;
34
35 --send INSERT INTO t1 VALUES (1, 'node_2');
36
37 --connection node_2a
38 SET SESSION wsrep_sync_wait = 0;
39 --let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
40 --source include/wait_condition.inc
41
42 SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
43
44 --connection node_2
45 --error ER_LOCK_DEADLOCK
46 --reap
47
48 --connection node_1
49 --reap
50
51 --connection node_2a
52 SET GLOBAL DEBUG_DBUG = "";
53 SET DEBUG_SYNC = "RESET";
54
55 #
56 # Keep track of the current position in variable $expected_position
57 #
58 --let $expected_position_uuid = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_local_state_uuid'`
59 --let $expected_position_seqno = `SELECT VARIABLE_VALUE FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_last_committed'`
60
61 --let $expected_position = $expected_position_uuid:$expected_position_seqno
62 --disconnect node_2a
63
64 #
65 # Shutdown node 2
66 #
67 --connection node_2
68 --source include/shutdown_mysqld.inc
69
70 --connection node_1
71 SET SESSION wsrep_sync_wait = 0;
72 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size';
73 --source include/wait_condition.inc
74
75 #
76 # Check that start position matches the position we recorded
77 # before shutdown in $expected_position
78 #
79 --let $galera_wsrep_recover_server_id = 2
80 --source suite/galera/include/galera_wsrep_recover.inc
81
82 if ($galera_wsrep_start_position != $expected_position)
83 {
84 --exec echo "expected position $expected_position"
85 --exec echo "recover position $galera_wsrep_start_position"
86 die("Expected position and recover position did not match");
87 }
88
89 #
90 # Restart node 2 and cleanup
91 #
92 --connection node_2
93 --source include/start_mysqld.inc
94
95 --connection node_1
96 DROP TABLE t1;
97 SET GLOBAL wsrep_slave_threads = DEFAULT;
98
99 --source include/auto_increment_offset_restore.inc