Debian Codegraph @

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

raw
1 #
2 # MDEV-30955
3 # Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE,
4 # table->s->db.str, table->s->table_name.str, MDL_SHARED)'
5 # failed in close_thread_table()
6 #
7
8 --source include/galera_cluster.inc
9
10 #
11 # Test 1: Assertion thd->mdl_context.is_lock_owner()
12 # failed in close_thread_table()
13 #
14 CREATE TABLE t (a CHAR(1) KEY);
15 START TRANSACTION;
16 HANDLER t OPEN;
17
18 #
19 # If bug is present the transaction will be aborted
20 # through Wsrep_client_service::bf_rollback() and
21 # release explicit locks too early. Later, during
22 # THD::cleanup(), table t will be closed and the
23 # THD is expected to be owner of the MDL lock that
24 # was just released.
25 #
26 --disconnect node_1
27
28 --connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1
29 DROP TABLE t;
30
31
32 #
33 # Test 2: Similar issue reproduces also with BACKUP STAGE locks.
34 # See comments in MDEV-25037
35 #
36
37 BACKUP STAGE START;
38 START TRANSACTION;
39 --disconnect node_1
40 --connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1
41
42
43 #
44 # Test 3: Assertion `!thd->mdl_context.has_locks()' failed
45 # in do_command()
46 #
47
48 --connection node_1
49 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
50 CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
51
52 --let $bf_count = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.global_status WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
53
54 START TRANSACTION;
55 INSERT INTO t1 VALUES(1);
56 HANDLER t2 OPEN;
57
58 --connection node_2
59 INSERT INTO t1 VALUES(1);
60
61 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
62 --connection node_1a
63 --let $wait_condition = SELECT VARIABLE_VALUE = $bf_count + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'
64 --source include/wait_condition.inc
65
66 --connection node_1
67 --error ER_LOCK_DEADLOCK
68 COMMIT;
69
70 DROP TABLE t1,t2;