summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test
blob: 6d49247ab5e39dc6b6d4fd840138a053412eec63 (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
--source include/galera_cluster.inc
--source include/have_innodb.inc

#
# Test the case where the cluster splits 3 ways.
# The master transitions to a non-prim view and back to prim. Its ongoing
# should fail to commit.
#

--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2

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

--connection node_2
SET SESSION wsrep_trx_fragment_size = 1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (20);
INSERT INTO t1 VALUES (21);
INSERT INTO t1 VALUES (22);
INSERT INTO t1 VALUES (23);
INSERT INTO t1 VALUES (24);

--connection node_1
--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log
--source include/wait_condition.inc

#
# Isolate node_2 into a separate non-primary component
#

--connection node_2a
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--disable_query_log
SET WSREP_ON=OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SET WSREP_ON=ON;
--enable_query_log

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

#
# Confirm that node_1 has no transactions in SR table
#

--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 0 FROM mysql.wsrep_streaming_log;
--source include/wait_condition.inc

#
# Restore cluster
#

--connection node_2a
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--source include/galera_wait_ready.inc

--connection node_1
--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_1
SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log;

--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
SELECT * FROM t1;
COMMIT;

--connection node_1
SELECT * FROM t1;

DROP TABLE t1;

--connection node_2
CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");