Re: explicit tracking of ActiveSnapshot - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: explicit tracking of ActiveSnapshot
Date
Msg-id 20080414235753.GB11292@alvh.no-ip.org
Whole thread Raw
In response to explicit tracking of ActiveSnapshot  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-patches
Alvaro Herrera wrote:

> In the previous installment,
> http://archives.postgresql.org/message-id/20080328140606.GL7464@alvh.no-ip.org
> I was wondering whether the tracking of snapshots could be made more
> robust by having ActiveSnapshot be some sort of stack instead of a
> global pointer.  So I set to do that, and it turns out to appear a sane
> thing to do.  Here is a patch.

Here is the combined patch, keeping track of both ActiveSnapshot as a
stack and snapshots registered on a list.  I figured out that the
easiest way to manage the memory is to keep track of reference counts in
the snapshot itself, separately for the active snapshot stack and the
registered list, so we know the earliest time to free it.

Open issues:

- SerializableSnapshot is not handled.  (I think this is just a matter
of adding a RegisterSnapshot call as soon as the serializable snapshot
is created).

- Creating the VacuumXmin stuff to actually use it, and decide what to
do with GetOldestXmin.


Comments are very welcome.

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

Attachment

pgsql-patches by date:

Previous
From: "Brendan Jurd"
Date:
Subject: Removing typename from A_Const (was: Empty arrays with ARRAY[])
Next
From: Magnus Hagander
Date:
Subject: Re: libpq Win32 Mutex performance patch