List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:December 8 2009 1:27pm
Subject:bzr commit into mysql-5.6-next-mr branch (jon.hauglid:3003)
View as plain text  
#At file:///export/home/z/mysql-next-4284-bp2/ based on revid:jon.hauglid@stripped

 3003 Jon Olav Hauglid	2009-12-08
      Backport of revno: 2617.65.1
      
      Bug #22876 Four-way deadlock
      
      This bug was fixed as a part of Bug#989 
      "If DROP TABLE while there's an active transaction, wrong binlog order"
      A statement which would have caused circular wait will now 
      be aborted with ER_LOCK_DEADLOCK.
      
      Test case based on bug description added to innodb_mysql_lock.test.
      Note that innodb_lock_wait_timeout is set to 5 mins to 
      prevent race conditions in the test.

    added:
      mysql-test/r/innodb_mysql_lock.result
      mysql-test/t/innodb_mysql_lock-master.opt
      mysql-test/t/innodb_mysql_lock.test
=== added file 'mysql-test/r/innodb_mysql_lock.result'
--- a/mysql-test/r/innodb_mysql_lock.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/innodb_mysql_lock.result	2009-12-08 13:27:33 +0000
@@ -0,0 +1,24 @@
+#
+# 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;
+commit;

=== added file 'mysql-test/t/innodb_mysql_lock-master.opt'
--- a/mysql-test/t/innodb_mysql_lock-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_mysql_lock-master.opt	2009-12-08 13:27:33 +0000
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=300

=== added file 'mysql-test/t/innodb_mysql_lock.test'
--- a/mysql-test/t/innodb_mysql_lock.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/innodb_mysql_lock.test	2009-12-08 13:27:33 +0000
@@ -0,0 +1,58 @@
+-- source include/have_innodb.inc
+
+--echo #
+--echo # Bug #22876 Four-way deadlock
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+connect (con3,localhost,root,,);
+
+--echo # Connection 1
+connection con1;
+set @@autocommit=0;
+CREATE TABLE t1(s1 INT UNIQUE) ENGINE=innodb;
+INSERT INTO t1 VALUES (1);
+
+--echo # Connection 2
+connection con2;
+set @@autocommit=0;
+INSERT INTO t1 VALUES (2);
+--send INSERT INTO t1 VALUES (1)
+
+--echo # Connection 3
+connection con3;
+set @@autocommit=0;
+--send DROP TABLE t1
+
+--echo # Connection 1
+connection con1;
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM information_schema.processlist
+  WHERE info = "INSERT INTO t1 VALUES (1)" and 
+  state = "update";
+--source include/wait_condition.inc
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM information_schema.processlist
+  WHERE info = "DROP TABLE t1" and 
+  state = "Waiting for table";
+--source include/wait_condition.inc
+--echo # Connection 1 is now holding the lock.
+--echo # Issuing insert from connection 1 while connection 2&3 
+--echo # is waiting for the lock should give a deadlock error.
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (2);
+
+--echo # Cleanup
+connection con2;
+--reap
+commit;
+connection con1;
+commit;
+connection con3;
+--reap
+connection default;


Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20091208132733-j36p4qnx1mkg6tbh.bundle
Thread
bzr commit into mysql-5.6-next-mr branch (jon.hauglid:3003) Jon Olav Hauglid8 Dec