Skip to content

Commit 5ad30e8

Browse files
temeoNirbhay Choubey
authored andcommitted
MTR test for checking correctness of fragmentation over CCs
1 parent cf43620 commit 5ad30e8

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 TEXT);
2+
SET GLOBAL wsrep_cluster_address='';
3+
SET SESSION wsrep_sync_wait=0;
4+
SET GLOBAL wsrep_provider_options = 'dbug=d,gcs_core_after_frag_send';
5+
SET SESSION wsrep_retry_autocommit=0;
6+
INSERT INTO t1 VALUES (1, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
7+
SET SESSION wsrep_on = 0;
8+
SET SESSION wsrep_on = 1;
9+
SET GLOBAL wsrep_provider_options = 'dbug=';
10+
SET GLOBAL wsrep_cluster_address = 'gcomm://127.0.0.1:13001';
11+
SET SESSION wsrep_on = 0;
12+
SET SESSION wsrep_on = 1;
13+
INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
14+
SET GLOBAL wsrep_provider_options = 'signal=gcs_core_after_frag_send';
15+
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
16+
INSERT INTO t1 VALUES (3, "cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
17+
SELECT * FROM t1;
18+
f1 f2
19+
2 bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
20+
3 cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
21+
SELECT * FROM t1;
22+
f1 f2
23+
2 bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
24+
3 cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
25+
DROP TABLE t1;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
!include ../galera_2nodes.cnf
2+
[mysqld.1]
3+
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64'
4+
[mysqld.2]
5+
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64'
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Test fragmentation over configuration changes
2+
--source include/galera_cluster.inc
3+
--source include/have_innodb.inc
4+
5+
# Prepare table
6+
CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 TEXT);
7+
8+
# Stop node2
9+
10+
# Disconnect node_2 from group
11+
--connection node_2
12+
--let $wsrep_cluster_address_orig = `select @@wsrep_cluster_address`
13+
SET GLOBAL wsrep_cluster_address='';
14+
15+
# Connection for sync points
16+
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
17+
SET SESSION wsrep_sync_wait=0;
18+
19+
# Set breakpoint in gcs after first fragment send
20+
21+
--let $galera_sync_point = gcs_core_after_frag_send
22+
--source include/galera_set_sync_point.inc
23+
24+
--connection node_1
25+
SET SESSION wsrep_retry_autocommit=0;
26+
--send INSERT INTO t1 VALUES (1, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
27+
28+
--connection node_1a
29+
--source include/galera_wait_sync_point.inc
30+
--source include/galera_clear_sync_point.inc
31+
32+
33+
# Restart node_2, wait until it joins the group and then make INSERT
34+
--connection node_2
35+
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'
36+
SET SESSION wsrep_on = 0;
37+
--source include/galera_wait_ready.inc
38+
SET SESSION wsrep_on = 1;
39+
40+
INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
41+
42+
# Signal node_1 to continue
43+
--connection node_1a
44+
--source include/galera_signal_sync_point.inc
45+
46+
# Deadlock error should be returned since write set send was
47+
# interrupted by gcs
48+
--connection node_1
49+
--error ER_LOCK_DEADLOCK
50+
--reap
51+
52+
# Do additional insert to verify that node_1 remain operational
53+
INSERT INTO t1 VALUES (3, "cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
54+
55+
56+
# Nodes node_1 and node_2 should now contain rows 2 and 3
57+
SELECT * FROM t1;
58+
59+
--connection node_2
60+
SELECT * FROM t1;
61+
62+
--connection node_1
63+
64+
DROP TABLE t1;

0 commit comments

Comments
 (0)