Re: Avoiding deadlocks ... - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: Avoiding deadlocks ...
Date
Msg-id 4C6E3F50.80404@agliodbs.com
Whole thread Raw
In response to Avoiding deadlocks ...  (Josh Berkus <josh@agliodbs.com>)
Responses Re: Avoiding deadlocks ...  (Thom Brown <thom@linux.com>)
Re: Avoiding deadlocks ...  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
List pgsql-hackers
On 8/19/10 3:51 PM, Josh Berkus wrote:
> Kevin,
> 
> This one is for you:
> 
> Two sessions, in transaction:
> 
> Process A        Process B
> 
> update session where id = X;
>             update order where orderid = 5;
> update order where orderid = 5;
>             update order where orderid = 5;
> ... deadlock error.

Johto on IRC pointed out I left something out of the above: "session" is
referenced in an FK by "orders", and session = X is related to orderid = 5.

> 
> It seems like we ought to be able to avoid a deadlock in this case;
> there's a clear precedence of who grabbed the order row first.  Does
> your serializability patch address the above situation at all?
> 


--                                  -- Josh Berkus                                    PostgreSQL Experts Inc.
                        http://www.pgexperts.com
 


pgsql-hackers by date:

Previous
From: tomas@tuxteam.de
Date:
Subject: Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!
Next
From: Thom Brown
Date:
Subject: Re: Avoiding deadlocks ...