# An attempt to repeat the bug #52020 # MySQL == 5.1 # -- source include/have_innodb.inc -- source include/count_sessions.inc connect (first,localhost,root,,); connect (second,localhost,root,,); connect (third,localhost,root,,); connect (fourth,localhost,root,,); select @@global.innodb_locks_unsafe_for_binlog; select @@global.innodb_lock_wait_timeout; connection default; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=INNODB; INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5,5), (6,6), (7,7), (8,8), (9,9), (10,10), (100,100); #INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5,5), (6,6), (7,7), (8,8), (9,9), (10,10); --disable_query_log connection first; BEGIN; connection second; BEGIN; connection third; BEGIN; connection fourth; BEGIN; #connection first; #reap; #connection second; #reap; let $i = 40; while ($i) { dec $i; let $n = 50 - $i; connection first; SEND_EVAL INSERT t1 VALUES ($n,$n) ON DUPLICATE KEY UPDATE b=1000; dec $i; let $n = 50 - $i; connection second; SEND_EVAL INSERT t1 VALUES ($n,$n) ON DUPLICATE KEY UPDATE b=10000; dec $i; let $n = 50 - $i; connection third; SEND_EVAL INSERT t1 VALUES ($n,$n) ON DUPLICATE KEY UPDATE b=10000; dec $i; let $n = 50 - $i; connection fourth; SEND_EVAL INSERT t1 VALUES ($n,$n) ON DUPLICATE KEY UPDATE b=10000; connection first; reap; sleep 0.05; connection second; reap; sleep 0.05; connection third; reap; connection fourth; reap; } # show innodb status; connection first; COMMIT; connection second; COMMIT; connection third; COMMIT; connection fourth; COMMIT; #connection first; #reap; #connection second; #reap; --enable_query_log connection default; SELECT * FROM t1; DROP TABLE t1; # Close connections --disconnect first --disconnect second --disconnect third --disconnect fourth # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc #show innodb status; exit;