Re: Snapshot management, final

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Snapshot management, final
Дата
Msg-id 2719.1210554205@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Snapshot management, final  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Snapshot management, final  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-patches
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane wrote:
>> Shouldn't UnregisterSnapshot insist that s_level be equal to current
>> xact nest level?

> It can't check that; consider

> begin;
> savepoint foo;
> declare cur cursor for select (1), (2), (3);
> savepoint bar;
> close cur;
> commit;

Hmm ... but that "close" can't unregister the snapshot immediately,
because you'd lose if the 2nd savepoint gets rolled back, no?  Is the
handling of this case even correct at the moment?

ISTM correct handling of this example would require that the "close"
not really discard the snap until commit.  Then, given proper ordering
of the cleanup operations at commit, you might be able to still have the
cross-check about s_level in UnregisterSnapshot.  (IOW, maybe having
snapshot cleanup be late in the commit sequence wasn't such a good
choice...)

            regards, tom lane

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

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