Re: parallel mode and parallel contexts - Mailing list pgsql-hackers

From Robert Haas
Subject Re: parallel mode and parallel contexts
Date
Msg-id CA+TgmoazbDuaQ2mWqDHFEDtBqj_rYSn7BQQM=G6jmHT7C3RXJw@mail.gmail.com
Whole thread Raw
In response to Re: parallel mode and parallel contexts  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: parallel mode and parallel contexts
List pgsql-hackers
On Tue, Jan 6, 2015 at 3:04 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
> If you can explain it in more detail in comments and README, I may
> agree. At present, I don't get it and it makes me nervous.
>
> The comment says
> "Only the top frame of the transaction state stack is copied to a parallel
> worker"
> but I'm not sure why.
>
> Top meaning the current subxact or the main xact?
> If main, why are do we need XactTopTransactionId

Current subxact.

I initially thought of copying the entire TransactionStateData stack,
but Heikki suggested (via IM) that I do it this way instead.  I
believe his concern was that it's never valid to commit or roll back
to a subtransaction that is not at the top of the stack, and if you
don't copy the stack, you avoid the risk of somehow ending up in that
state.  Also, you avoid having to invent resource owners for
(sub)transactions that don't really exist in the current process.  On
the other hand, you do end up with a few special cases that wouldn't
exist with the other approach.  Still, I'm pretty happy to have taken
Heikki's advice: it was certainly simple to implement this way, plus
hopefully that way at least one person likes what I ended up with.
:-)

What else needs clarification?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Updating copyright notices to 2015 for PGDG
Next
From: Robert Haas
Date:
Subject: Re: Possible typo in create_policy.sgml