List:Commits« Previous MessageNext Message »
From:marko.makela Date:November 10 2011 3:01pm
Subject:bzr push into mysql-5.1 branch (marko.makela:3639 to 3640) Bug#7975
Bug#11759688 Bug#12842206
View as plain text  
 3640 Marko Mäkelä	2011-11-10
      Bug #12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE: Add a test case.
      The bug was accidentally fixed by fixing
      Bug#11759688 52020: InnoDB can still deadlock on just INSERT...ON DUPLICATE KEY
      a.k.a. the reintroduction of
      Bug#7975 deadlock without any locking, simple select and update

    modified:
      mysql-test/suite/innodb/r/innodb-lock.result
      mysql-test/suite/innodb/t/innodb-lock.test
      mysql-test/suite/innodb_plugin/r/innodb-lock.result
      mysql-test/suite/innodb_plugin/t/innodb-lock.test
 3639 Marko Mäkelä	2011-11-10
      Bug#11759688 52020: InnoDB can still deadlock on just INSERT...ON DUPLICATE KEY
      a.k.a. Bug#7975 deadlock without any locking, simple select and update
      
      Bug#7975 was reintroduced when the storage engine API was made
      pluggable in MySQL 5.1. Instead of looking at thd->lex directly, we
      rely on handler::extra(). But, we were looking at the wrong extra()
      flag, and we were ignoring the TRX_DUP_REPLACE flag in places where we
      should obey it.
      
      innodb_replace.test: Add tests for hopefully all affected statement
      types, so that bug should never ever resurface. This kind of tests
      should have been added when fixing Bug#7975 in MySQL 5.0.3 in the
      first place.
      
      rb:806 approved by Sunny Bains

    added:
      mysql-test/suite/innodb/r/innodb_replace.result
      mysql-test/suite/innodb/t/innodb_replace.test
      mysql-test/suite/innodb_plugin/r/innodb_replace.result
      mysql-test/suite/innodb_plugin/t/innodb_replace.test
    modified:
      sql/sql_insert.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/row/row0ins.c
      storage/innodb_plugin/ChangeLog
      storage/innodb_plugin/handler/ha_innodb.cc
      storage/innodb_plugin/row/row0ins.c
=== modified file 'mysql-test/suite/innodb/r/innodb-lock.result'
--- a/mysql-test/suite/innodb/r/innodb-lock.result	revid:marko.makela@stripped
+++ b/mysql-test/suite/innodb/r/innodb-lock.result	revid:marko.makela@stripped
@@ -55,3 +55,20 @@ id	x
 1	1
 2	10
 drop table t1;
+#
+#Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
+#fixed by re-fixing Bug#7975
+#aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(3,1);
+BEGIN;
+INSERT IGNORE INTO t1 VALUES(3,14);
+BEGIN;
+INSERT IGNORE INTO t1 VALUES(3,23);
+SELECT * FROM t1 FOR UPDATE;
+COMMIT;
+a	b
+3	1
+COMMIT;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/innodb/t/innodb-lock.test'
--- a/mysql-test/suite/innodb/t/innodb-lock.test	revid:marko.makela@stripped104931-w8xtuv02nfjbi2an
+++ b/mysql-test/suite/innodb/t/innodb-lock.test	revid:marko.makela@stripped547-w53wufbtl15w163p
@@ -100,3 +100,44 @@ select * from t1;
 drop table t1;
 
 # End of 4.1 tests
+
+--echo #
+--echo #Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
+--echo #fixed by re-fixing Bug#7975
+--echo #aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
+--echo #
+
+connection default;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES(3,1);
+
+BEGIN;
+# this used to wrongly acquire an X lock; now it takes an S lock
+INSERT IGNORE INTO t1 VALUES(3,14);
+
+connection con1;
+BEGIN;
+# this used to wrongly acquire an X lock; now it takes an S lock
+INSERT IGNORE INTO t1 VALUES(3,23);
+--send
+SELECT * FROM t1 FOR UPDATE;
+
+connection con2;
+# Check that the above SELECT is blocked
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = 'Sending data' and
+        info = 'SELECT * FROM t1 FOR UPDATE';
+--source include/wait_condition.inc
+
+connection default;
+COMMIT;
+connection con1;
+reap;
+COMMIT;
+disconnect con1;
+disconnect con2;
+
+connection default;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/innodb_plugin/r/innodb-lock.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb-lock.result	revid:marko.makela@stripped
+++ b/mysql-test/suite/innodb_plugin/r/innodb-lock.result	revid:marko.makela@stripped
@@ -55,3 +55,20 @@ id	x
 1	1
 2	10
 drop table t1;
+#
+#Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
+#fixed by re-fixing Bug#7975
+#aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(3,1);
+BEGIN;
+INSERT IGNORE INTO t1 VALUES(3,14);
+BEGIN;
+INSERT IGNORE INTO t1 VALUES(3,23);
+SELECT * FROM t1 FOR UPDATE;
+COMMIT;
+a	b
+3	1
+COMMIT;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/innodb_plugin/t/innodb-lock.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb-lock.test	revid:marko.makela@strippedom-20111110104931-w8xtuv02nfjbi2an
+++ b/mysql-test/suite/innodb_plugin/t/innodb-lock.test	revid:marko.makela@oracle.com-20111110144547-w53wufbtl15w163p
@@ -100,3 +100,44 @@ select * from t1;
 drop table t1;
 
 # End of 4.1 tests
+
+--echo #
+--echo #Bug#12842206 INNODB LOCKING REGRESSION FOR INSERT IGNORE
+--echo #fixed by re-fixing Bug#7975
+--echo #aka Bug#11759688 52020: InnoDB can still deadlock on just INSERT...
+--echo #
+
+connection default;
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES(3,1);
+
+BEGIN;
+# this used to wrongly acquire an X lock; now it takes an S lock
+INSERT IGNORE INTO t1 VALUES(3,14);
+
+connection con1;
+BEGIN;
+# this used to wrongly acquire an X lock; now it takes an S lock
+INSERT IGNORE INTO t1 VALUES(3,23);
+--send
+SELECT * FROM t1 FOR UPDATE;
+
+connection con2;
+# Check that the above SELECT is blocked
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = 'Sending data' and
+        info = 'SELECT * FROM t1 FOR UPDATE';
+--source include/wait_condition.inc
+
+connection default;
+COMMIT;
+connection con1;
+reap;
+COMMIT;
+disconnect con1;
+disconnect con2;
+
+connection default;
+DROP TABLE t1;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1 branch (marko.makela:3639 to 3640) Bug#7975Bug#11759688 Bug#12842206marko.makela11 Nov