Re: PushActiveSnapshot(GetTransactionSnapshot())

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PushActiveSnapshot(GetTransactionSnapshot())
Date: 2011-08-23 13:56:17
Message-ID: CA+U5nMKtnyxh5f_zkxtMiFQKKYFpuE+RWypse8--LBdq4DjBbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 22, 2011 at 7:07 PM, Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:
> Excerpts from Simon Riggs's message of dom ago 21 16:23:39 -0300 2011:
>> In common cases of snapshot use we run GetSnapshotData() into a
>> statically allocated snapshot, then immediately copy the static struct
>> into a dynamically allocated copy.
>>
>> The static allocation was designed to remove the overhead of dynamic
>> allocation, but then we do it anyway.
>>
>> The snapmgr code does this explicitly, but the reason isn't
>> documented, it just says we must do this.
>
> IIRC the active snapshot is scribbled onto by some operations, which is
> why the copy is mandatory.  Maybe there's some way to optimize things so
> that the copy is done only when necessary.  IIRC the copying of the
> ActiveSnapshot was only introduced because some subtle bugs were
> detected in the code without copy.  When I introduced the mandatory
> copy, I don't remember thinking about the statically allocated struct.

"Some operations", "subtle bugs".

Do you have any further information on those?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-08-23 14:21:35 Re: PushActiveSnapshot(GetTransactionSnapshot())
Previous Message Pavel Stehule 2011-08-23 12:16:06 Re: VIP: plpgsql - early embedded sql plan preparation