Re: Deadlock possibility in _bt_check_unique?

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Gokulakannan Somasundaram <gokul007(at)gmail(dot)com>
Cc: pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Deadlock possibility in _bt_check_unique?
Date: 2010-03-23 10:19:49
Message-ID: 4BA895C5.2080000@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gokulakannan Somasundaram 2010-03-23 13:08:24 Re: Deadlock possibility in _bt_check_unique?
Previous Message Gokulakannan Somasundaram 2010-03-23 09:53:43 Deadlock possibility in _bt_check_unique?