Debian Codegraph @

mysql-test/suite/galera/t/MDEV-33136.test

raw
1 #
2 # MDEV-33136: Properly BF-abort user transactions with explicit locks
3 #
4 # User transactions may acquire explicit MDL locks from InnoDB level
5 # when persistent statistics is re-read for a table.
6 # If such a transaction would be subject to BF-abort, it was improperly
7 # detected as a system transaction and wouldn't get aborted.
8 #
9 # The fix: Check if a transaction holding explicit MDL locks is a user
10 # transaction in the MDL conflict handling code.
11
12 --source include/galera_cluster.inc
13 --source include/have_innodb.inc
14 --source include/have_debug_sync.inc
15 --source include/have_debug.inc
16
17 --connect node_1a,127.0.0.1,root,,test,$NODE_MYPORT_1
18
19 --connection node_1
20 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
21
22 --connection node_1a
23 RENAME TABLE t1 TO tmp, tmp TO t1;
24 # RENAME forces the next statement to re-read statistics from persistent storage,
25 # which will acquire MDL locks on the statistics tables in InnoDB.
26 SET SESSION wsrep_retry_autocommit = 0;
27 SET DEBUG_SYNC = 'dict_stats_mdl_acquired SIGNAL may_toi WAIT_FOR bf_abort';
28 --send
29 INSERT INTO t1 VALUES (1);
30
31 --connection node_1
32 SET DEBUG_SYNC = 'now WAIT_FOR may_toi';
33 TRUNCATE TABLE t1;
34
35 --connection node_1a
36 # Local INSERT gets aborted.
37 --error ER_LOCK_DEADLOCK
38 --reap
39
40 # Cleanup
41 --connection node_1
42 SET DEBUG_SYNC = 'RESET';
43 DROP TABLE t1;
44 --disconnect node_1a
45 --source include/galera_end.inc