5
5
6
6
--source include/galera_cluster.inc
7
7
--source include/have_innodb.inc
8
+ --source include/have_debug_sync.inc
9
+ --source include/have_debug.inc
8
10
9
11
#
10
12
# Make bulk insert BF-abort, but regular insert succeed.
13
15
--connection node_1
14
16
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
15
17
18
+ # Delay applying of the single insert from the other node.
19
+ SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
20
+
21
+ --connection node_1
16
22
# Disable foreign and unique key checks to allow bulk insert.
17
23
SET foreign_key_checks = 0;
18
24
SET unique_checks = 0;
@@ -30,18 +36,28 @@ while ($count < 1000)
30
36
31
37
--connection node_2
32
38
33
- # Disable bulk insert.
39
+ # Disable bulk insert on this node .
34
40
SET foreign_key_checks = 1;
35
41
SET unique_checks = 1;
36
42
37
43
# Insert a value out of the bulk insert range.
38
44
INSERT INTO t1 VALUES (1001);
39
45
40
46
--connection node_1
47
+
48
+ # We need to trigger Galera-level certification conflict. For this:
49
+ # - start applying single insert from the other node before bulk insert certifies
50
+ # - certifying bulk insert will lead to the conflict
51
+ # - keep applying single insert
52
+ SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached';
53
+ SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb';
54
+
41
55
--error ER_LOCK_DEADLOCK
42
56
COMMIT;
43
57
44
58
DROP TABLE t1;
59
+ SET GLOBAL DEBUG_DBUG = '';
60
+ SET DEBUG_SYNC = 'RESET';
45
61
46
62
#
47
63
# Make bulk insert succeed, but regular insert BF-abort.
@@ -50,8 +66,17 @@ DROP TABLE t1;
50
66
--connection node_1
51
67
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
52
68
69
+ --connection node_2
70
+ # Delay applying of the bulk insert from the other node.
71
+ SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
72
+
73
+ --connection node_1
53
74
--let $before_bulk_keys = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'`
54
75
76
+ # Disable foreign and unique key checks to allow bulk insert.
77
+ SET foreign_key_checks = 0;
78
+ SET unique_checks = 0;
79
+
55
80
START TRANSACTION;
56
81
57
82
--let $count=0
@@ -64,8 +89,7 @@ while ($count < 1000)
64
89
--enable_query_log
65
90
66
91
--connection node_2
67
-
68
- # Disable bulk insert.
92
+ # Disable bulk insert on this node.
69
93
SET foreign_key_checks = 1;
70
94
SET unique_checks = 1;
71
95
@@ -77,12 +101,23 @@ INSERT INTO t1 VALUES (1001);
77
101
--connection node_1
78
102
COMMIT;
79
103
80
- # Expect two keys to be added for bulk insert: DB-level shared key and table-level exclusive key.
104
+ # Expect three keys to be added for bulk insert: "zero-level" key, DB-level shared key and table-level exclusive key.
81
105
--let $bulk_keys_count = `SELECT VARIABLE_VALUE - $before_bulk_keys FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_repl_keys'`
82
106
--echo $bulk_keys_count
83
107
84
108
--connection node_2
109
+
110
+ # We need to trigger Galera-level certification conflict. For this:
111
+ # - start applying bulk insert from the other node before local insert certifies
112
+ # - certifying local insert will lead to the conflict
113
+ # - keep applying bulk insert
114
+ SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR sync.wsrep_apply_cb_reached';
115
+ SET DEBUG_SYNC = 'wsrep_after_certification SIGNAL signal.wsrep_apply_cb';
116
+
85
117
--error ER_LOCK_DEADLOCK
86
118
COMMIT;
87
119
88
120
DROP TABLE t1;
121
+ SET GLOBAL DEBUG_DBUG = '';
122
+ SET DEBUG_SYNC = 'RESET';
123
+ --source include/galera_end.inc
0 commit comments