Re: NT + deadlock intended behaviour ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: NT + deadlock intended behaviour ?
Date: 2004-07-18 05:38:57
Message-ID: 27764.1090129137@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gaetano Mendola <mendola(at)bigfoot(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2004-07-18 05:50:11 PITR COPY Failure (was Point in Time Recovery)
Previous Message Alvaro Herrera 2004-07-18 05:33:47 Re: NT + deadlock intended behaviour ?