Re: Deadlocks on inserts to the same table
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!
Subject
Views
Written By
Posted
5631
January 03, 2005 04:15PM
2915
January 06, 2005 12:12PM
2828
January 10, 2005 05:05PM
3026
January 12, 2005 01:37AM
2794
January 12, 2005 05:23PM
Re: Deadlocks on inserts to the same table
2853
January 13, 2005 09:59AM
2830
January 14, 2005 07:33AM
3044
February 18, 2005 04:45AM
4245
February 19, 2005 01:01AM
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.