Re: [Glue] Deadlock bug - Mailing list pgsql-hackers

From Greg Stark
Subject Re: [Glue] Deadlock bug
Date
Msg-id AANLkTikcvVbjGizDTn8k7P6UVJMXdjR6iDxv1-zz89Dp@mail.gmail.com
Whole thread Raw
In response to Re: [Glue] Deadlock bug  (Joel Jacobson <joel@gluefinance.com>)
Responses Re: [Glue] Deadlock bug
List pgsql-hackers
On Fri, Aug 20, 2010 at 7:38 PM, Joel Jacobson <joel@gluefinance.com> wrote:
> If the locking logic would be modified to allow process 2 to go through, and
> instead abort process 1, I understand some other scenarios would of course
> be affected, where the situation would be handled in a less optimal way.

Which process dies when there's a deadlock is pretty much arbitary.
The first process to notice the deadlock will just throw an error
itself.  Which one notices first depends on the timing of when the
blocking locks were taken.

If the second process to get stuck blocks before the first process
checks then the first process will notice first. If it does other
stuff first then the first process will check, not find a deadlock and
go back to sleep. Then the deadlock won't be detected until the second
process checks.

-- 
greg


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: git: uh-oh
Next
From: Joel Jacobson
Date:
Subject: Re: [Glue] Deadlock bug