# # Bug #22876 Four-way deadlock # DROP TABLE IF EXISTS t1; # Connection 1 set @@autocommit=0; CREATE TABLE t1(s1 INT UNIQUE) ENGINE=innodb; INSERT INTO t1 VALUES (1); # Connection 2 set @@autocommit=0; INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (1); # Connection 3 set @@autocommit=0; DROP TABLE t1; # Connection 1 # Connection 1 is now holding the lock. # Issuing insert from connection 1 while connection 2&3 # is waiting for the lock should give a deadlock error. INSERT INTO t1 VALUES (2); ERROR 40001: Deadlock found when trying to get lock; try restarting transaction # Cleanup commit; set @@autocommit=1; commit; set @@autocommit=1; set @@autocommit=1; # # Bug #42147 Concurrent DML and LOCK TABLE ... READ for InnoDB # table cause warnings in errlog # # # Note that this test for now relies on a global suppression of # the warning "Found lock of type 6 that is write and read locked" # This suppression rule can be removed once Bug#42147 is properly # fixed. See bug page for more info. # DROP TABLE IF EXISTS t1; CREATE TABLE t1 (i INT) engine= innodb; # Connection 2 # Get user-level lock SELECT get_lock('bug42147_lock', 60); get_lock('bug42147_lock', 60) 1 # Connection 1 INSERT INTO t1 SELECT get_lock('bug42147_lock', 60); # Connection 2 LOCK TABLES t1 READ; SELECT release_lock('bug42147_lock'); release_lock('bug42147_lock') 1 # Connection 1 # Connection 2 UNLOCK TABLES; # Connection 1 DROP TABLE t1;