| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
--source include/count_sessions.inc |
| 4 |
|
| 5 |
--echo # |
| 6 |
--echo # Bug #21983865 UNEXPECTED DEADLOCK WITH INNODB_AUTOINC_LOCK_MODE=0 |
| 7 |
--echo # |
| 8 |
|
| 9 |
create table t1(f1 int not null auto_increment primary key) engine=innodb; |
| 10 |
|
| 11 |
--echo # Hold autoinc_lock on table t1 from connection con1 |
| 12 |
connect (con1, localhost, root); |
| 13 |
set debug_sync='ib_after_row_insert SIGNAL others WAIT_FOR continue_others'; |
| 14 |
--send insert into t1 values(NULL) |
| 15 |
|
| 16 |
connection default; |
| 17 |
--echo # Create 40 connections and make it to wait for autoinc_lock on table t1. |
| 18 |
--disable_query_log |
| 19 |
set debug_sync='now WAIT_FOR others'; |
| 20 |
let $1=2; |
| 21 |
while ($1 < 40) { |
| 22 |
connect (con$1,localhost,root); |
| 23 |
--send insert into t1 values(NULL) |
| 24 |
inc $1; |
| 25 |
connection default; |
| 26 |
} |
| 27 |
|
| 28 |
connect (con40,localhost,root); |
| 29 |
--enable_query_log |
| 30 |
--echo # Release the auto_inc lock on table t1 for connection con1 |
| 31 |
set debug_sync='now SIGNAL continue_others'; |
| 32 |
|
| 33 |
--echo # Now all 40 connections can finish the insert operation on t1. |
| 34 |
let $1=1; |
| 35 |
connection default; |
| 36 |
disconnect con40; |
| 37 |
while ($1 < 40) { |
| 38 |
connection con$1; |
| 39 |
--reap |
| 40 |
connection default; |
| 41 |
disconnect con$1; |
| 42 |
inc $1; |
| 43 |
} |
| 44 |
|
| 45 |
drop table t1; |
| 46 |
--source include/wait_until_count_sessions.inc |