Re: SAVEPOINTs and COMMIT performance - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: SAVEPOINTs and COMMIT performance
Date
Msg-id CA+U5nMJnrMWAzymxLoWkoH-oxpq7L4bsUO760buupHArLp7Tgw@mail.gmail.com
Whole thread Raw
In response to Re: SAVEPOINTs and COMMIT performance  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
On Mon, Jun 6, 2011 at 10:33 AM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> On 06.02.2011 23:09, Simon Riggs wrote:
>>
>> On Sun, 2011-02-06 at 12:11 -0500, Bruce Momjian wrote:
>>>
>>> Did this ever get addressed?
>>
>> Patch attached.
>>
>> Seems like the easiest fix I can come up with.
>
>> @@ -2518,7 +2518,7 @@ CommitTransactionCommand(void)
>>                case TBLOCK_SUBEND:
>>                        do
>>                        {
>> -                               CommitSubTransaction();
>> +                               CommitSubTransaction(true);
>>                                s = CurrentTransactionState;    /* changed
>> by pop */
>>                        } while (s->blockState == TBLOCK_SUBEND);
>>                        /* If we had a COMMIT command, finish off the main
>> xact too */
>
> We also get into this codepath at RELEASE SAVEPOINT, in which case it is
> wrong to not reassign the locks to the parent subtransaction.

Attached patch splits TBLOCK_SUBEND state into two new states:
TBLOCK_SUBCOMMIT and TBLOCK_SUBRELEASE, so that we can do the right
thing.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: Understanding GIN posting trees
Next
From: Magnus Hagander
Date:
Subject: Re: patch for distinguishing PG instances in event log