Debian Codegraph @

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

raw
1 #
2 # Test that a joiner performing IST can be killed and restarted with no adverse consequences.
3 # This is achieved by using the recv_IST_after_apply_trx Galera dbug sync point to block IST after
4 # one transaction has been applied. When IST blocks, we kill and restart the joiner
5 #
6
7 --source include/galera_cluster.inc
8 --source include/have_innodb.inc
9 --source include/have_debug_sync.inc
10 --source include/galera_have_debug_sync.inc
11 # This could cause out of storage if run /dev/shm
12 --source include/big_test.inc
13
14 # Save original auto_increment_offset values.
15 --let $node_1=node_1
16 --let $node_2=node_2
17 --source include/auto_increment_offset_save.inc
18
19 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
20 INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a');
21
22 # Disconnect node #2
23 --connection node_2
24 SET SESSION wsrep_sync_wait=0;
25 --source suite/galera/include/galera_stop_replication.inc
26
27 --connection node_1
28 UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
29
30 # Wait until node #1 has left
31 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
32 --source include/wait_condition.inc
33
34 UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
35
36 --connection node_2
37 # Write file to make mysql-test-run.pl expect the crash, but don't start it
38 --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
39 --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
40 --write_line wait $_expect_file_name
41
42 --let KILL_NODE_PIDFILE = `SELECT @@pid_file`
43
44 # ... and restart provider to force IST
45 --echo Loading wsrep_provider ...
46 --disable_query_log
47 # Make sure IST will block ...
48 --let $galera_sync_point = recv_IST_after_apply_trx
49 --source include/galera_set_sync_point.inc
50 --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
51 --enable_query_log
52
53 SET SESSION wsrep_on=OFF;
54 --let $wait_condition = SELECT VARIABLE_VALUE = 'recv_IST_after_apply_trx' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
55 --source include/wait_condition.inc
56 SET SESSION wsrep_on=ON;
57
58 --connection node_1
59 # Perform DML while IST is in progress
60 UPDATE t1 SET f2 = 'd' WHERE f1 > 3;
61
62 # Kill node #2 while IST is in progress
63 --connection node_2
64 --source include/kill_galera.inc
65
66 --connection node_1
67 --source include/wait_until_connected_again.inc
68 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
69 --source include/wait_condition.inc
70
71 # Perform DML while node #2 is down
72 UPDATE t1 SET f2 = 'e' WHERE f1 > 4;
73
74 --connection node_2
75
76 --let $galera_wsrep_recover_server_id=2
77 --source suite/galera/include/galera_wsrep_recover.inc
78
79 --echo Starting server ...
80 --source include/start_mysqld.inc
81
82 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
83 --source include/wait_condition.inc
84
85 --connection node_1
86 UPDATE t1 SET f2 = 'f' WHERE f1 > 5;
87 SELECT * FROM t1;
88
89 --connection node_2
90 SELECT * FROM t1;
91
92 --connection node_1
93 DROP TABLE t1;
94
95 # Restore original auto_increment_offset values.
96 --source include/auto_increment_offset_restore.inc
97
98 --source include/galera_end.inc