MySQL Forums
Forum List  »  InnoDB

Re: Deadlocks on inserts to the same table
Posted by: Radu Chiriac
Date: January 13, 2005 09:59AM

hmm... i thought in this case a duplicate key error should be generated (which i was expecting) instead of a deadlock.. Thank u, i understand now where this deadlock comes from... and understanding this can think of some ways to handle it

So, the order of events is something like this:

__tx1_____________________________tx2
not started________________________begin;
_________________________________get auto-inc lock
_________________________________get index lock for a unique (client_id, client_category_id)
____________________________________________combination (let this combination be (1, '1-1')
_________________________________insert record with uq index value (1, '1-1')
_________________________________... some other similar inserts....
_________________________________... still active
begin;____________________________... still active
get auto-inc lock____________________... still active
try to get lock on uq idx value (1, '1-1')__try to get auto-inc lock (holding the prev locks)
___________________...... deadlock ......
__________________..... rollback tx1 .......

Thank u, Heikki!

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Deadlocks on inserts to the same table
2853
January 13, 2005 09:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.