Commit 6947ee37 authored by Magne Mahre's avatar Magne Mahre

Bug #37183 insert ignore into .. select ... hangs after

           deadlock was encountered

The bug is caused by an inconsistent handling of the IGNORE
clause.  A read from a const table caused a lock timeout
(ER_LOCK_TIMEOUT) in innodb.  Since the IGNORE clause was
given, the timeout was converted into a warning instead of
an error, thus not populating the diagnostics area.  When
innodb subsequently marked the transaction for rollback,
mysql asserted since the diag.area was empty.

This patch consists of only a test case, as the bug itself
was fixed by the patch for Bug #46539
parent edfd29dd
......@@ -48,6 +48,24 @@ commit;
set autocommit=default;
drop table t1;
#
# Bug #37183 insert ignore into .. select ... hangs
# after deadlock was encountered
#
create table t1(id int primary key,v int)engine=innodb;
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
create table t2 like t1;
begin;
update t1 set v=id*2 where id=1;
begin;
update t1 set v=id*2 where id=2;
update t1 set v=id*2 where id=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore into t2 select * from t1 where id=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
rollback;
drop table t1, t2;
#
# Bug#41756 Strange error messages about locks from InnoDB
#
drop table if exists t1;
......
......@@ -70,6 +70,40 @@ commit;
set autocommit=default;
drop table t1;
--echo #
--echo # Bug #37183 insert ignore into .. select ... hangs
--echo # after deadlock was encountered
--echo #
connect (con1,localhost,root,,);
create table t1(id int primary key,v int)engine=innodb;
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
create table t2 like t1;
--connection con1
begin;
update t1 set v=id*2 where id=1;
--connection default
begin;
update t1 set v=id*2 where id=2;
--connection con1
--error 1205
update t1 set v=id*2 where id=2;
--connection default
--error 1205
insert ignore into t2 select * from t1 where id=1;
rollback;
--connection con1
rollback;
--connection default
disconnect con1;
drop table t1, t2;
--echo #
--echo # Bug#41756 Strange error messages about locks from InnoDB
--echo #
......
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