Re: Use of ActiveSnapshot

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Use of ActiveSnapshot
Дата
Msg-id 26999.1179171340@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Use of ActiveSnapshot  (Jan Wieck <JanWieck@Yahoo.com>)
Ответы Re: Use of ActiveSnapshot  (Jan Wieck <JanWieck@Yahoo.com>)
Список pgsql-hackers
Jan Wieck <JanWieck@Yahoo.com> writes:
> The only problem with that is that there are code paths that set 
> ActiveSnapshot to palloc()'d memory that is released due to a 
> MemoryContextDelete() without resetting ActiveSnapshot to NULL.

Only at the very end of a transaction (where ActiveSnapshot *is* reset
to null, in FreeXactSnapshot); otherwise we'd have bugs unrelated to
RevalidateCachedPlan.  Eventually I would like to have reference-counted
snapshots managed by a centralized module, as was discussed a month or
two back; but right at the moment I don't think it's broken and I don't
want to spend time on intermediate solutions.

> I think it would be cleaner if RevalidateCachedPlan()'s API would have a 
> Snapshot argument.

How does that improve anything?  AFAICS the only thing that would ever
get passed is ActiveSnapshot, so this is just more notation to do
exactly the same thing.
        regards, tom lane


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

Предыдущее
От: "Pavel Stehule"
Дата:
Сообщение: Re: pg_comparator table diff/sync
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Use of ActiveSnapshot