Re: Snapshot management, final

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Snapshot management, final
Дата
Msg-id 20080422215056.GJ6912@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Snapshot management, final  (Simon Riggs <simon@2ndquadrant.com>)
Ответы Re: Snapshot management, final  (Simon Riggs <simon@2ndquadrant.com>)
Re: Snapshot management, final  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
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.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

В списке pgsql-patches по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Snapshot management, final
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Snapshot management, final