Re: Snapshot management, final - Mailing list pgsql-patches

From Simon Riggs
Subject Re: Snapshot management, final
Date
Msg-id 1208901518.4259.1272.camel@ebony.site
Whole thread Raw
In response to Re: Snapshot management, final  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Snapshot management, final  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-patches
On Tue, 2008-04-22 at 17:50 -0400, Alvaro Herrera wrote:
> Simon Riggs wrote:
> > On Tue, 2008-04-22 at 15:49 -0400, Alvaro Herrera wrote:
> >
> > > - Three CopySnapshot call sites remain outside snapmgr.c: DoCopy() on
> > > copy.c, ExplainOnePlan() on explain.c and _SPI_execute_plan() on spi.c.
> > > They are there because they grab the current ActiveSnapshot, modify it,
> > > and then use the resulting snapshot.  There is no corresponding
> > > FreeSnapshot, because it's not needed.
> >
> > Not needed? How can we be certain that the modified snapshot does not
> > outlive its original source?
>
> It's not CopySnapshot that's not needed, but FreeSnapshot.  The point
> here is that the snapshot will be freed automatically as soon as it is
> PopActiveSnapshot'd out of existance.  CopySnapshot creates a new,
> separate copy of the passed snapshot, and each of them will be freed
> (separately) as soon as their refcounts reach zero.

OK, so it can;t be copied to a longer lived memory context?

--
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com


pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Snapshot management, final
Next
From: Alvaro Herrera
Date:
Subject: Re: Snapshot management, final