Skip to content

Commit c684675

Browse files
committed
Merge 10.4 into 10.5
2 parents a61e556 + 0cc811c commit c684675

23 files changed

+295
-187
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
connection node_2;
2+
connection node_1;
3+
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
4+
LOCK TABLE t1 WRITE CONCURRENT;
5+
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
6+
connection node_1a;
7+
SET lock_wait_timeout= 1;
8+
CREATE VIEW v1 AS SELECT * FROM t1;
9+
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
10+
connection node_1b;
11+
SET SESSION wsrep_sync_wait = 0;
12+
connection node_1;
13+
UNLOCK TABLES;
14+
connection node_1a;
15+
DROP VIEW v1;
16+
DROP TABLE t1;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--source include/galera_cluster.inc
2+
--source include/have_log_bin.inc
3+
4+
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
5+
LOCK TABLE t1 WRITE CONCURRENT;
6+
7+
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
8+
--connection node_1a
9+
# TOI operations will ignore lock_wait_timeout
10+
SET lock_wait_timeout= 1;
11+
--send CREATE VIEW v1 AS SELECT * FROM t1
12+
13+
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
14+
--connection node_1b
15+
SET SESSION wsrep_sync_wait = 0;
16+
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table level lock'
17+
--source include/wait_condition.inc
18+
19+
--connection node_1
20+
UNLOCK TABLES;
21+
22+
--connection node_1a
23+
--reap
24+
25+
DROP VIEW v1;
26+
DROP TABLE t1;

mysql-test/suite/galera_3nodes_sr/disabled.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
GCF-336 :
22
GCF-582 :
3-
GCF-609 :
43
GCF-810A :
54
GCF-810B :
65
GCF-810C :
Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,78 @@
1+
connection node_2;
2+
connection node_1;
13
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
4+
connection node_1;
25
SET SESSION wsrep_trx_fragment_size=1;
36
SET AUTOCOMMIT=OFF;
47
START TRANSACTION;
58
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
9+
connection node_2;
610
SET SESSION wsrep_trx_fragment_size=1;
711
SET AUTOCOMMIT=OFF;
812
START TRANSACTION;
913
INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
1014
INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
11-
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
15+
ERROR 23000: Duplicate entry '11' for key 'PRIMARY'
1216
INSERT INTO t1 VALUES (31),(32),(33);
1317
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
1418
COUNT(*) = 0
1519
0
20+
connection node_1;
1621
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
1722
COUNT(*) = 0
1823
0
1924
COMMIT;
25+
connection node_2;
26+
COMMIT;
27+
SELECT * FROM t1;
28+
f1
29+
1
30+
2
31+
3
32+
4
33+
5
34+
6
35+
7
36+
8
37+
9
38+
10
39+
11
40+
12
41+
13
42+
14
43+
15
44+
16
45+
17
46+
18
47+
19
48+
20
49+
31
50+
32
51+
33
52+
connection node_1;
53+
SELECT * FROM t1;
54+
f1
55+
1
56+
2
57+
3
58+
4
59+
5
60+
6
61+
7
62+
8
63+
9
64+
10
65+
11
66+
12
67+
13
68+
14
69+
15
70+
16
71+
17
72+
18
73+
19
74+
20
75+
31
76+
32
77+
33
2078
DROP TABLE t1;

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SET SESSION wsrep_trx_fragment_size=1;
1717
SET AUTOCOMMIT=OFF;
1818
START TRANSACTION;
1919
INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
20-
--error ER_LOCK_DEADLOCK
20+
--error ER_DUP_ENTRY
2121
INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
2222
INSERT INTO t1 VALUES (31),(32),(33);
2323

@@ -27,4 +27,11 @@ SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
2727
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
2828
COMMIT;
2929

30+
--connection node_2
31+
COMMIT;
32+
SELECT * FROM t1;
33+
34+
--connection node_1
35+
SELECT * FROM t1;
36+
3037
DROP TABLE t1;

mysql-test/suite/galera_sr/r/GCF-572.result

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
connection node_2;
22
connection node_1;
3-
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB;
43
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
54
connection node_1;
65
SET SESSION wsrep_trx_fragment_size = 1;
6+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
7+
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
8+
INSERT INTO t2 VALUES (1),(2),(3);
9+
ALTER TABLE t2 DROP PRIMARY KEY;
10+
INSERT INTO t2 VALUES (1);
11+
SET SESSION wsrep_trx_fragment_size = 1;
12+
START TRANSACTION;
13+
INSERT INTO t1 SELECT * FROM t2;
14+
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
15+
SELECT * FROM t1;
16+
f1
17+
connection node_2;
18+
SELECT * FROM t1;
19+
f1
20+
connection node_1;
21+
DROP TABLE t1;
22+
DROP TABLE t2;
23+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB;
24+
connection node_1;
25+
SET SESSION wsrep_trx_fragment_size = 1;
726
START TRANSACTION;
827
INSERT INTO t1 VALUES (1, 'node1');
928
connection node_1a;
1029
INSERT INTO t1 VALUES (5, 'node2');
1130
connection node_1;
1231
INSERT INTO t1 VALUES (5, 'node1');
13-
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
32+
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
1433
SELECT * FROM t1;
1534
f1 f2
35+
1 node1
1636
5 node2
1737
SET SESSION wsrep_trx_fragment_size = 10000;
1838
START TRANSACTION;
@@ -24,13 +44,15 @@ INSERT INTO t1 VALUES(15, 'node2');
2444
connection node_1;
2545
SELECT * FROM t1;
2646
f1 f2
47+
1 node1
2748
5 node2
2849
10 node1
2950
INSERT INTO t1 VALUES(15, 'node1');
3051
ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
3152
COMMIT;
3253
SELECT * FROM t1;
3354
f1 f2
55+
1 node1
3456
5 node2
3557
10 node1
3658
15 node2

mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ INSERT INTO t1 VALUES (REPEAT('e', 512));
1313
INSERT INTO t1 VALUES (REPEAT('f', 512));
1414
connection node_2;
1515
connection node_1;
16-
INSERT INTO t1 VALUES (REPEAT('c', 512));
16+
INSERT INTO t1 VALUES (REPEAT('g', 1024)),(REPEAT('c', 512));
1717
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
1818
connection node_1;
1919
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
connection node_2;
2+
connection node_1;
3+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
4+
SET SESSION wsrep_trx_fragment_size=1;
5+
START TRANSACTION;
6+
INSERT INTO t1 VALUES (1);
7+
SET SESSION wsrep_cluster_name = ' ';
8+
ERROR HY000: Variable 'wsrep_cluster_name' is a GLOBAL variable and should be set with SET GLOBAL
9+
INSERT INTO t1 VALUES (2);
10+
COMMIT;
11+
SELECT f1 AS expect_1_and_2 FROM t1;
12+
expect_1_and_2
13+
1
14+
2
15+
DROP TABLE t1;

mysql-test/suite/galera_sr/t/GCF-572.test

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,43 @@
11
--source include/galera_cluster.inc
22
--source include/have_innodb.inc
33

4-
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB;
5-
64
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
75

86
#
9-
# Test 1: statement rollback is not safe
10-
# (some fragments were already replicated)
7+
# Test 1: statement rollback is not safe.
8+
# Statement has already replicated some fragments
119
#
10+
--connection node_1
11+
SET SESSION wsrep_trx_fragment_size = 1;
12+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
13+
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
14+
INSERT INTO t2 VALUES (1),(2),(3);
15+
ALTER TABLE t2 DROP PRIMARY KEY;
16+
INSERT INTO t2 VALUES (1);
1217

18+
SET SESSION wsrep_trx_fragment_size = 1;
19+
START TRANSACTION;
20+
21+
# The following INSERT .. SELECT inserts a duplicate key,
22+
# ER_LOCK_DEADLOCK is the only possible outcome at this point.
23+
# Notice that ER_DUP_ENTRY is NOT an option here because we were
24+
# forced to rollback the whole transaction (not just the statement)
25+
--error ER_LOCK_DEADLOCK
26+
INSERT INTO t1 SELECT * FROM t2;
27+
SELECT * FROM t1;
28+
29+
--connection node_2
30+
SELECT * FROM t1;
31+
32+
--connection node_1
33+
DROP TABLE t1;
34+
DROP TABLE t2;
35+
36+
#
37+
# Test 2: statement rollback is safe.
38+
# Fragments were already replicated, not in the same statement
39+
#
40+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB;
1341
--connection node_1
1442
SET SESSION wsrep_trx_fragment_size = 1;
1543
START TRANSACTION;
@@ -19,20 +47,16 @@ INSERT INTO t1 VALUES (1, 'node1');
1947
INSERT INTO t1 VALUES (5, 'node2');
2048

2149
--connection node_1
22-
# If we try to INSERT a duplicate key, ER_LOCK_DEADLOCK is the only possible
23-
# outcome at this point. Notice that ER_DUP_ENTRY is NOT an option here
24-
# because we were forced to rollback the whole transaction (not just the
25-
# statement)
26-
--error ER_LOCK_DEADLOCK
50+
# Only the statement is rolled back, expect ER_DUP_ENTRY
51+
--error ER_DUP_ENTRY
2752
INSERT INTO t1 VALUES (5, 'node1');
2853

2954
SELECT * FROM t1;
3055

3156
#
32-
# Test 2: statement rollback is safe
33-
# (no fragments have been replicated)
57+
# Test 3: statement rollback is safe
58+
# No fragments have been replicated
3459
#
35-
3660
SET SESSION wsrep_trx_fragment_size = 10000;
3761

3862
START TRANSACTION;

mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ INSERT INTO t1 VALUES (REPEAT('f', 512));
2222
--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
2323

2424
--connection node_1
25-
# Deadlock error instead of dupkey since the transaction is SR and
26-
# statement rollback is not safe.
25+
# Deadlock error instead of dupkey since the transaction is SR,
26+
# and the statement has already replicated a fragment (which
27+
# makes statement rollback unsafe).
2728
--error ER_LOCK_DEADLOCK
28-
INSERT INTO t1 VALUES (REPEAT('c', 512));
29+
INSERT INTO t1 VALUES (REPEAT('g', 1024)),(REPEAT('c', 512));
2930

30-
# Confirm that the wsrep_streaming_log table is now empty, as it was a full transaction rollback
31+
# Confirm that the wsrep_schema table is now empty, as it was a full transaction rollback
3132

3233
--connection node_1
3334
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;

0 commit comments

Comments
 (0)