Commit 8c886b3b authored by Marko Mäkelä's avatar Marko Mäkelä

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
parent a0a51251
...@@ -55,3 +55,20 @@ id x ...@@ -55,3 +55,20 @@ id x
1 1 1 1
2 10 2 10
drop table t1; 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;
...@@ -100,3 +100,44 @@ select * from t1; ...@@ -100,3 +100,44 @@ select * from t1;
drop table t1; drop table t1;
# End of 4.1 tests # 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;
...@@ -55,3 +55,20 @@ id x ...@@ -55,3 +55,20 @@ id x
1 1 1 1
2 10 2 10
drop table t1; 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;
...@@ -100,3 +100,44 @@ select * from t1; ...@@ -100,3 +100,44 @@ select * from t1;
drop table t1; drop table t1;
# End of 4.1 tests # 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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment