Re: Use of ActiveSnapshot - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Use of ActiveSnapshot
Date
Msg-id 26999.1179171340@sss.pgh.pa.us
Whole thread Raw
In response to Use of ActiveSnapshot  (Jan Wieck <JanWieck@Yahoo.com>)
Responses Re: Use of ActiveSnapshot  (Jan Wieck <JanWieck@Yahoo.com>)
List 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 by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: pg_comparator table diff/sync
Next
From: Jan Wieck
Date:
Subject: Re: Use of ActiveSnapshot