Debian Codegraph @

mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test

raw
1 #
2 # Test mysqldump SST on slave if SR transaction is in progress
3 #
4
5 --source include/big_test.inc
6 --source include/galera_cluster.inc
7
8 --source suite/galera/include/galera_sst_set_mysqldump.inc
9
10 # Save original auto_increment_offset values.
11 --let $node_1=node_1
12 --let $node_2=node_2
13 --source ../../galera/include/auto_increment_offset_save.inc
14
15 --connection node_1
16 CREATE TABLE ten (f1 INTEGER);
17 INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
18
19 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB;
20
21 SET AUTOCOMMIT=OFF;
22 SET SESSION wsrep_trx_fragment_size = 1000;
23 START TRANSACTION;
24 # Insert 1000 rows
25 INSERT INTO t1 (f2) SELECT REPEAT('x', 255) FROM ten AS a1, ten AS a2, ten AS a3;
26
27 # Update 1000 rows
28 UPDATE t1 SET f2 = REPEAT('y', 255);
29
30 # Wait for SR replication to kick in
31 --connection node_2
32 --let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
33 --source include/wait_condition.inc
34
35 # Restart node #2
36
37 --connection node_2
38 --let $MYSQLD2_DATADIR = `SELECT @@datadir`
39
40 --echo Shutting down server ...
41 --source include/shutdown_mysqld.inc
42
43 # Force SST
44 --remove_file $MYSQLD2_DATADIR/grastate.dat
45
46 --connection node_1
47 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
48 --source include/wait_condition.inc
49
50 --connection node_2
51 --let $restart_noprint = 1
52 --let $restart_parameters = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2
53 --source include/start_mysqld.inc
54
55 --connection node_1
56 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
57 --source include/wait_condition.inc
58
59 # Check that node #2 is caught up with the SR transaction that is still in progress
60 --connection node_2
61 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
62 SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
63 --let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
64 --source include/wait_condition.inc
65
66 # Finalize transaction
67 --connection node_1
68 UPDATE t1 SET f2 = REPEAT('z', 255);
69 COMMIT;
70
71 # Confirm proper replication of entire transaction to node #2
72 --connection node_2
73 SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
74 SELECT COUNT(*) = 1000 FROM t1;
75 SELECT COUNT(*) = 1000 FROM t1 WHERE f2 = REPEAT('z', 255);
76
77 DROP TABLE t1;
78 DROP TABLE ten;
79
80 --connection node_1
81 # galera_sst_restore.inc uses DROP USER internally which is incompatible
82 # with SR, need to disable SR before that.
83 SET SESSION wsrep_trx_fragment_size=0;
84 --source suite/galera/include/galera_sst_restore.inc
85
86 # Restore original auto_increment_offset values.
87 --source ../galera/include/auto_increment_offset_restore.inc