Debian Codegraph @

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

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # Test the effect of Cluster Configuration Change on a concurrently-running SR transaction
6 # We use SET GLOBAL wsrep_cluster_address = '' to cause the slave (node_2) to temporarily
7 # leave the cluster.
8 #
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 # Start with a clean slate
16 --connection node_2
17 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
18
19 --connection node_1
20 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
21 CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
22
23 --let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size`
24 SET SESSION wsrep_trx_fragment_size = 1;
25
26 SET AUTOCOMMIT=OFF;
27 START TRANSACTION;
28 INSERT INTO t1 VALUES (1);
29 INSERT INTO t1 VALUES (2);
30 INSERT INTO t1 VALUES (3);
31 INSERT INTO t1 VALUES (4);
32 INSERT INTO t1 VALUES (5);
33
34 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
35
36 --connection node_2
37 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
38
39 #
40 # Trigger CC . The transaction should be able to continue
41 #
42
43 --connection node_2
44 --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
45 SET GLOBAL wsrep_cluster_address = '';
46
47 # Wait until the node_2 disconnects from the cluster
48 SET SESSION wsrep_sync_wait = 0;
49 --let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
50 --source include/wait_condition.inc
51 SET SESSION wsrep_sync_wait = default;
52
53 --connection node_1
54
55 # Wait until the node_1 sees the cluster configuration change
56 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
57 --source include/wait_condition.inc
58
59 # Continue generating events in the transaction
60
61 SET innodb_snapshot_isolation=OFF;
62 INSERT INTO t1 VALUES (6);
63 INSERT INTO t1 VALUES (7);
64 INSERT INTO t1 VALUES (8);
65 INSERT INTO t1 VALUES (9);
66 INSERT INTO t1 VALUES (10);
67
68 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
69
70 # Restore cluster
71
72 --connection node_2
73 --disable_query_log
74 --eval SET GLOBAL wsrep_cluster_address='$wsrep_cluster_address_orig';
75 --enable_query_log
76 --source include/galera_wait_ready.inc
77
78 # Confirm that the SR table still contains entries from ongoing transaction
79 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
80
81 # Continue and finalize transaction
82 --connection node_1
83 INSERT INTO t1 VALUES (11);
84 INSERT INTO t1 VALUES (12);
85 INSERT INTO t1 VALUES (13);
86 INSERT INTO t1 VALUES (14);
87 INSERT INTO t1 VALUES (16);
88 COMMIT;
89
90 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
91
92 # Confirm that transaction was replicated properly
93 # and SR table is cleaned up afterwards.
94
95 --connection node_2
96 --let $wait_condition = SELECT COUNT(*) = 15 FROM t1;
97 --source include/wait_condition.inc
98
99 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
100
101 DROP TABLE t1;
102
103 CALL mtr.add_suppression("points to own listening address, blacklisting");
104
105 # Restore original auto_increment_offset values.
106 --source ../../galera/include/auto_increment_offset_restore.inc