Commit ae7e1b9b authored by Jan Lindström's avatar Jan Lindström

MDEV-13262: innodb.deadlock_detect failed in buildbot

There is a race condition on a test. con1 is the older transaction
as it query started wait first. Test continues so that con1 gets
lock wait timeout first. There is possibility that default connection
gets lock timeout also or as con1 is rolled back it gets the locks
it waited and does the update. Fixed by removing query outputs as
they could vary and accepting success from default connection
query.
parent 9ede5692
...@@ -8,21 +8,15 @@ PRIMARY KEY(id) ...@@ -8,21 +8,15 @@ PRIMARY KEY(id)
INSERT INTO t1 VALUES(1), (2), (3); INSERT INTO t1 VALUES(1), (2), (3);
BEGIN; BEGIN;
SELECT * FROM t1 WHERE id = 1 FOR UPDATE; SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
id
1
connect con1,localhost,root,,; connect con1,localhost,root,,;
BEGIN; BEGIN;
SELECT * FROM t1 WHERE id = 2 FOR UPDATE; SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
id
2
SELECT * FROM t1 WHERE id = 1 FOR UPDATE; SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
connection default; connection default;
SELECT * FROM t1 WHERE id = 2 FOR UPDATE; SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
connection con1; connection con1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
ROLLBACK; ROLLBACK;
connection default; connection default;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
ROLLBACK; ROLLBACK;
DROP TABLE t1; DROP TABLE t1;
disconnect con1; disconnect con1;
......
...@@ -18,6 +18,8 @@ CREATE TABLE t1( ...@@ -18,6 +18,8 @@ CREATE TABLE t1(
INSERT INTO t1 VALUES(1), (2), (3); INSERT INTO t1 VALUES(1), (2), (3);
# We are not interested query results, only errors
--disable_result_log
BEGIN; BEGIN;
SELECT * FROM t1 WHERE id = 1 FOR UPDATE; SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
...@@ -39,12 +41,22 @@ reap; ...@@ -39,12 +41,22 @@ reap;
ROLLBACK; ROLLBACK;
#
# Note here that con1 is the older transaction as it
# query started wait first. Thus, con1 gets lock
# wait timeout first. There is possibility that
# default connection gets lock timeout also or
# as con1 is rolled back it gets the locks it waited
# and does the update.
#
connection default; connection default;
--error ER_LOCK_WAIT_TIMEOUT --error 0,ER_LOCK_WAIT_TIMEOUT
reap; reap;
ROLLBACK; ROLLBACK;
--enable_result_log
DROP TABLE t1; DROP TABLE t1;
disconnect con1; disconnect con1;
......
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