Debian Codegraph @

mysql-test/suite/ndb/t/ndb_gsl_mdl_deadlock.test

raw
1 -- source include/have_ndb.inc
2 -- source include/have_debug.inc
3
4 --echo #
5 --echo # Bug#31875229 DEADLOCK BETWEEN CREATE DATABASE IF NOT EXISTS AND CREATE TABLE
6 --echo #
7
8 # Create couple of connections to mysqld1
9 connect(client1,127.0.0.1,root,,test,$MYSQLD_PORT_1);
10 connect(client2,127.0.0.1,root,,test,$MYSQLD_PORT_1);
11
12 --echo Send DDLs from both clients to trigger a deadlock
13
14 --enable_connect_log
15 --connection client1
16 # After acquiring the GSL, this client should wait for
17 # the other to acquire IX MDL on schema
18 SET DEBUG_SYNC = 'ndb_global_schema_lock_acquired WAIT_FOR schema_mdl_acquired';
19
20 # Send a 'CREATE DATABASE' - this will,
21 # 1. acquire the GSL
22 # 2. wait for other client to acquire IX MDL on schema
23 # 3. continues and attempts to acquire exclusive MDL on schema
24 --send CREATE DATABASE IF NOT EXISTS test
25
26 --connection client2
27 # This should signal the other after acquiring the IX MDL on schema
28 # Send it right before attempting to upgrade the MDL on table
29 SET DEBUG_SYNC = 'mdl_upgrade_lock SIGNAL schema_mdl_acquired';
30
31 # Send a 'CREATE TABLE' - this will,
32 # 1. acquire IX MDL on schema
33 # 2. signal the other client to continue
34 # 3. attempt to acquire the GSL so that its MDL on table could be upgraded
35 # 4. Thus triggering a potential deadlock
36 --send CREATE TABLE t1 (a int) engine ndb
37
38 --echo # Reap both DDLs and verify that they succeeded after resolving the deadlock
39 --connection client1
40 --disable_warnings ER_DB_CREATE_EXISTS ONCE
41 --reap
42
43 --connection client2
44 --reap
45
46 --echo Cleanup
47 --disable_connect_log
48 DROP TABLE t1;