Re: Deadlock possibility in _bt_check_unique? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Deadlock possibility in _bt_check_unique?
Date
Msg-id 4BA895C5.2080000@enterprisedb.com
Whole thread Raw
In response to Deadlock possibility in _bt_check_unique?  (Gokulakannan Somasundaram <gokul007@gmail.com>)
Responses Re: Deadlock possibility in _bt_check_unique?
List pgsql-hackers
Gokulakannan Somasundaram wrote:
> Hi,
>    With the implementation of deferred unique constraints, we need to go
> back to the index second time to check whether the unique check is valid.
> Say a situation occurs like this
> a) the first session doing the unique check finds out that there is a unique
> check required second time and just makes its entry and comes back
> b) the second session doing the unique check finds out that there is a
> unique check required second time and just makes its entry and comes back
> 
> While they do the second check, first session will wait for the session to
> complete and vice versa. Won't this result in a deadlock? Isn't this a
> realistic scenario?

Yes, that can happen. The deadlock detector will kick in and abort one
of the sessions.

--  Heikki Linnakangas EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Gokulakannan Somasundaram
Date:
Subject: Deadlock possibility in _bt_check_unique?
Next
From: Gokulakannan Somasundaram
Date:
Subject: Re: Deadlock possibility in _bt_check_unique?