Debian Codegraph @

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

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3
4 #
5 # Test a local transaction being aborted by a slave one while it is running a SELECT FOR UPDATE
6 #
7
8 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT) ENGINE=InnoDB;
9
10 INSERT INTO t1 VALUES (1, 10);
11
12 # Test updating the PK
13
14 --connection node_1
15 --let $wsrep_local_bf_aborts_before = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'`
16 BEGIN;
17 SELECT * FROM t1 FOR UPDATE;
18
19 --connection node_2
20 UPDATE t1 SET f1 = 2;
21
22 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
23 --let $wait_condition = SELECT COUNT(*) FROM t1 WHERE f1 = 2
24 --source include/wait_condition.inc
25
26 --connection node_1
27 --error ER_LOCK_DEADLOCK
28 COMMIT;
29
30 --disable_query_log
31 --eval SELECT variable_value - $wsrep_local_bf_aborts_before AS wsrep_local_bf_aborts_diff FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'
32 --enable_query_log
33
34 # Test updating non-indexed column
35
36 --connection node_1
37 --let $wsrep_local_bf_aborts_before = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'`
38 BEGIN;
39 SELECT * FROM t1 FOR UPDATE;
40
41 --connection node_2
42 UPDATE t1 SET f2 = 20;
43
44 --connection node_1a
45 --let $wait_condition = SELECT COUNT(*) FROM t1 WHERE f2 = 20
46 --source include/wait_condition.inc
47
48 --connection node_1
49 --error ER_LOCK_DEADLOCK
50 COMMIT;
51
52 --disable_query_log
53 --eval SELECT variable_value - $wsrep_local_bf_aborts_before AS wsrep_local_bf_aborts_diff FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'
54 --enable_query_log
55
56 DROP TABLE t1;