Bug #43211 | Deadlock detected on concurrent delete/insert into same table | ||
---|---|---|---|
Submitted: | 26 Feb 2009 7:14 | Modified: | 26 Feb 2009 9:16 |
Reporter: | Royce Lithgo | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Locking | Severity: | S2 (Serious) |
Version: | 5.0.51a-community-log | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[26 Feb 2009 7:14]
Royce Lithgo
[26 Feb 2009 9:16]
Sveta Smirnova
Thank you for the report. Default transaction isolation level for InnoDB is REPEATABLE READ. In this case "All consistent reads within the same transaction read the snapshot established by the first read." So transaction 2 holds lock "RECORD LOCKS space id 0 page no 50 n bits 72 index `PRIMARY` of table `test`.`ns_custom_app_transaction_lock` trx id 0 771 lock_mode X" (DELETE statement) and at the same time both transaction 1 and transaction 2 wait for the same lock for INSERT statements. So deadlock is expected. Workaround: use less strict transaction isolation level or innodb_locks_unsafe_for_binlog (you will get timeout instead of deadlock for second transaction in this case).