Debian Codegraph @

mysql-test/suite/galera/t/galera_sequences_bf_kill.test

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3 --source include/have_debug.inc
4 --source include/have_debug_sync.inc
5 --source include/galera_have_debug_sync.inc
6
7 --disable_ps2_protocol
8 #
9 # We create InnoDB seqeuence with small cache that is then
10 # used as default value for column in table.
11 #
12 --connection node_1
13 --let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
14 CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
15 CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
16 INSERT INTO t1 VALUES (1, 0), (3, 0);
17 --connection node_1
18 START TRANSACTION;
19 INSERT INTO t1 VALUES (4, next value for s); # No conflict in cert
20 INSERT INTO t1 VALUES (5, next value for s); # No conflict in cert
21 INSERT INTO t1 VALUES (6, next value for s); # No conflict in cert
22 INSERT INTO t1 VALUES (7, next value for s); # No conflict in cert
23 INSERT INTO t1 VALUES (8, next value for s); # No conflict in cert
24 INSERT INTO t1 VALUES (9, next value for s); # No conflict in cert
25 INSERT INTO t1 VALUES (10, next value for s); # No conflict in cert
26 INSERT INTO t1 VALUES (11, next value for s); # No conflict in cert
27 INSERT INTO t1 VALUES (12, next value for s); # No conflict in cert
28 INSERT INTO t1 VALUES (13, next value for s); # No conflict in cert
29 INSERT INTO t1 VALUES (14, next value for s); # No conflict in cert
30 SELECT * FROM t1 WHERE f1 > 0 FOR UPDATE; # Should cause GAP lock between 1 and 3
31
32 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
33 SET SESSION wsrep_sync_wait=0;
34 # Block the applier on node #1 and issue a conflicting update on node #2
35 --let $galera_sync_point = apply_monitor_slave_enter_sync
36 --source include/galera_set_sync_point.inc
37
38 #
39 # Send conflicting INSERT
40 #
41 --connection node_2
42 INSERT INTO t1 VALUES (2, 2); # This should BF abort because of GAP lock
43
44 --connection node_1a
45 --source include/galera_wait_sync_point.inc
46 --source include/galera_clear_sync_point.inc
47
48 # Block the commit, send the COMMIT and wait until it gets blocked
49 --let $galera_sync_point = commit_monitor_master_enter_sync
50 --source include/galera_set_sync_point.inc
51
52 --connection node_1
53 --send COMMIT
54
55 --connection node_1a
56
57 --let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync
58 --source include/galera_wait_sync_point.inc
59 --source include/galera_clear_sync_point.inc
60
61 --let $galera_sync_point = abort_trx_end
62 --source include/galera_set_sync_point.inc
63 --let $galera_sync_point = apply_monitor_slave_enter_sync
64 --source include/galera_signal_sync_point.inc
65 --let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync
66 --source include/galera_wait_sync_point.inc
67
68 # Let the transactions proceed
69 --source include/galera_clear_sync_point.inc
70 --let $galera_sync_point = abort_trx_end
71 --source include/galera_signal_sync_point.inc
72 --let $galera_sync_point = commit_monitor_master_enter_sync
73 --source include/galera_signal_sync_point.inc
74
75 # Commit succeeds
76 --connection node_1
77 --reap
78
79 # wsrep_local_replays has increased by 1
80 --let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
81 --disable_query_log
82 --eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
83 --enable_query_log
84
85 INSERT INTO t1 VALUES (22, next value for s);
86 INSERT INTO t1 VALUES (23, next value for s);
87 INSERT INTO t1 VALUES (24, next value for s);
88 INSERT INTO t1 VALUES (25, next value for s);
89 INSERT INTO t1 VALUES (26, next value for s);
90 INSERT INTO t1 VALUES (27, next value for s);
91 INSERT INTO t1 VALUES (28, next value for s);
92 INSERT INTO t1 VALUES (29, next value for s);
93 INSERT INTO t1 VALUES (30, next value for s);
94 INSERT INTO t1 VALUES (31, next value for s);
95 INSERT INTO t1 VALUES (32, next value for s);
96 INSERT INTO t1 VALUES (33, next value for s);
97 INSERT INTO t1 VALUES (34, next value for s);
98 INSERT INTO t1 VALUES (35, next value for s);
99
100 --connection node_1
101 SELECT * FROM t1;
102 SELECT LASTVAL(s);
103
104 --connection node_2
105 SELECT * FROM t1;
106 SELECT LASTVAL(s);
107
108 --connection node_1
109 SELECT NEXTVAL(s);
110
111 --connection node_2
112 SELECT NEXTVAL(s);
113
114 DROP SEQUENCE s;
115 DROP TABLE t1;