summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test
blob: a32da9594295b7830a9774651e5aa45f276257a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#
# GCF-817 SR: master removes SR trx in non-primary view
#

--source include/galera_cluster.inc

--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--source ../galera/include/auto_increment_offset_save.inc

--connection node_1
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;

SET SESSION wsrep_trx_fragment_size = 1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7);

--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET SESSION wsrep_sync_wait = 0;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;

--connection node_2
--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
--source include/wait_condition.inc

--connection node_1a
# Force node #1 to go non-primary
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';

SET SESSION wsrep_on = OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc

# SR table on master should still contain entries after going non-Prim
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

# SR table on slave should eventually clean up entries when master goes non-Prim
--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

# Restore node #1 to primary

--connection node_1a
#
# The following sleep is a workaround for issue GCF-861.
# Normally it's sufficient to make sure that the CC happened
# by checking that wsrep_cluster_size has shrinked, as above.
# However that is not always enough, so we sleep a few seconds.
# See GCF-861 on how to reproduce.
#

--connection node_1a
--sleep 6
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';

--connection node_3
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

--connection node_1a
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc

--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--source include/galera_wait_ready.inc

# SR table on master should contain no entries after going back to Prim state
--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
--source include/wait_condition.inc

--connection node_2
# And none on slave
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;

--connection node_1
--error ER_LOCK_DEADLOCK
COMMIT;

# SR table is now empty everywhere
--connection node_1a
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;

--connection node_2
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;

--connection node_2
DROP TABLE t1;

--source ../galera/include/auto_increment_offset_restore.inc