blob: e3e7411c7eaa5b844d223fc8377200b11e879be7 (
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
#
# Test the following sequence of events:
#
# 1. Node #1 begins a transaction
# 2. Node #2 performs a conflicting insert
# 3. Node #1 attempts to SR-replicate a conflicting transaction
#
# to sync node_1 appliers
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
SET SESSION wsrep_trx_fragment_size = 2;
SET SESSION wsrep_trx_fragment_unit = 'statements';
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
SET AUTOCOMMIT=OFF;
START TRANSACTION;
--connection node_1a
SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
SET SESSION wsrep_sync_wait = 0;
--connection node_2
INSERT INTO t1 VALUES (1);
--connection node_1a
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SELECT COUNT(*) = 0 FROM t1;
--connection node_1
SELECT COUNT(*) = 0 FROM t1;
--send INSERT INTO t1 VALUES (1);
--connection node_1a
# Wait for the above INSERT to fail certification
--connection node_1a
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
--source include/wait_condition.inc
SET GLOBAL DEBUG_DBUG = '';
SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
COMMIT;
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--connection node_1a
SET DEBUG_SYNC = 'RESET';
#
# Similar test with BYTES unit
#
--connection node_1
TRUNCATE TABLE t1;
SET SESSION wsrep_trx_fragment_size = 10;
SET SESSION wsrep_trx_fragment_unit = 'bytes';
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
SET AUTOCOMMIT=OFF;
START TRANSACTION;
--connection node_1a
SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
SET SESSION wsrep_sync_wait = 0;
--connection node_2
INSERT INTO t1 VALUES (1);
--connection node_1a
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SELECT COUNT(*) = 0 FROM t1;
--connection node_1
SELECT COUNT(*) = 0 FROM t1;
--send INSERT INTO t1 VALUES (1)
# Wait for the above INSERT to fail certification
--connection node_1a
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
--source include/wait_condition.inc
SET GLOBAL DEBUG_DBUG = '';
SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
ROLLBACK;
SELECT * FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--connection node_2
SELECT * FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--connection node_1a
SET DEBUG_SYNC = 'RESET';
#
# One more test with BYTES unit, but now fragment size is adjusted so
# that second insert should trigger fragment replication.
# Currently 200 bytes is good choice here, but this may change with
# future MySQL versions.
# => If this test fails after some MySQL merge, check if frgament size
# needs to be tuned to spot at second insert statement.
#
--connection node_1
TRUNCATE TABLE t1;
SET SESSION wsrep_trx_fragment_size = 200;
SET SESSION wsrep_trx_fragment_unit = 'bytes';
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'`
SET AUTOCOMMIT=OFF;
START TRANSACTION;
--connection node_1a
SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
SET SESSION wsrep_sync_wait = 0;
--connection node_2
INSERT INTO t1 VALUES (1);
--connection node_1a
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SELECT COUNT(*) = 0 FROM t1;
--connection node_1
INSERT INTO t1 VALUES (1);
--send INSERT INTO t1 VALUES (2)
# Wait for the above INSERT to fail certification
--connection node_1a
--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'
--source include/wait_condition.inc
SET GLOBAL DEBUG_DBUG = '';
SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb';
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
COMMIT;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
--connection node_1a
DROP TABLE t1;
SET DEBUG_SYNC = 'RESET';
--connection node_2
CALL mtr.add_suppression("WSREP: Could not find applier context for");
|