Re: NT + deadlock intended behaviour ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: NT + deadlock intended behaviour ?
Date
Msg-id 27764.1090129137@sss.pgh.pa.us
Whole thread Raw
In response to NT + deadlock intended behaviour ?  (Gaetano Mendola <mendola@bigfoot.com>)
Responses Re: NT + deadlock intended behaviour ?
List pgsql-hackers
Gaetano Mendola <mendola@bigfoot.com> writes:
> why SESSION 1 was unblocked ?
> ...
> Why that commit unblock the SESSION 1?

IMHO session 1 should have been unblocked in both cases as soon as
session 2's subtransaction failed.  We have always made a practice
of releasing a transaction's locks immediately upon failure.

The reason it does not seem to act that way is that Alvaro's taken a
shortcut in WaitForTransaction: subtransactions do not take out a
separate transaction lock and so WaitForTransaction has to wait for the
top-level transaction.  Your sub-COMMIT fails the outer transaction
(because the inner one is failed) and so the top transaction lock
releases at that point.  In the sub-ABORT case the outer transaction
stays good and continues to hold its lock.

I've already suggested that this shortcut is no good, and now I'm
pretty sure of it ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: NT + deadlock intended behaviour ?
Next
From: Mark Kirkwood
Date:
Subject: PITR COPY Failure (was Point in Time Recovery)