Debian Codegraph @

mysql-test/suite/galera_3nodes_sr/t/GCF-817.test

raw
1 #
2 # GCF-817 SR: master removes SR trx in non-primary view
3 #
4
5 --source include/galera_cluster.inc
6
7 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
8
9 # Save original auto_increment_offset values.
10 --let $node_1=node_1
11 --let $node_2=node_2
12 --let $node_3=node_3
13 --source ../galera/include/auto_increment_offset_save.inc
14
15 --connection node_1
16 CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
17
18 SET SESSION wsrep_trx_fragment_size = 1;
19 SET AUTOCOMMIT=OFF;
20 START TRANSACTION;
21 INSERT INTO t1 VALUES (1);
22 INSERT INTO t1 VALUES (2);
23 INSERT INTO t1 VALUES (3);
24 INSERT INTO t1 VALUES (4);
25 INSERT INTO t1 VALUES (5);
26 INSERT INTO t1 VALUES (6);
27 INSERT INTO t1 VALUES (7);
28
29 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
30 SET SESSION wsrep_sync_wait = 0;
31 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
32
33 --connection node_2
34 --let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
35 --source include/wait_condition.inc
36
37 --connection node_1a
38 # Force node #1 to go non-primary
39 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
40
41 SET SESSION wsrep_on = OFF;
42 --let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
43 --source include/wait_condition.inc
44
45 # SR table on master should still contain entries after going non-Prim
46 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
47
48 --connection node_2
49 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
50 --source include/wait_condition.inc
51
52 # SR table on slave should eventually clean up entries when master goes non-Prim
53 --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
54 --source include/wait_condition.inc
55
56 --connection node_3
57 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
58 --source include/wait_condition.inc
59
60 # Restore node #1 to primary
61
62 --connection node_1a
63 #
64 # The following sleep is a workaround for issue GCF-861.
65 # Normally it's sufficient to make sure that the CC happened
66 # by checking that wsrep_cluster_size has shrinked, as above.
67 # However that is not always enough, so we sleep a few seconds.
68 # See GCF-861 on how to reproduce.
69 #
70
71 --connection node_1a
72 --sleep 6
73 SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
74
75 --connection node_3
76 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
77 --source include/wait_condition.inc
78
79 --connection node_1a
80 --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
81 --source include/wait_condition.inc
82
83 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
84 --source include/wait_condition.inc
85
86 --source include/galera_wait_ready.inc
87
88 # SR table on master should contain no entries after going back to Prim state
89 --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
90 --source include/wait_condition.inc
91
92 --connection node_2
93 # And none on slave
94 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
95
96 --connection node_1
97 --error ER_LOCK_DEADLOCK
98 COMMIT;
99
100 # SR table is now empty everywhere
101 --connection node_1a
102 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
103
104 --connection node_2
105 SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
106
107 --connection node_2
108 DROP TABLE t1;
109
110 --source ../galera/include/auto_increment_offset_restore.inc