Re: explicit tracking of ActiveSnapshot

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: explicit tracking of ActiveSnapshot
Date: 2008-04-14 23:57:53
Message-ID: 20080414235753.GB11292@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
snapshot-5.patch text/x-diff 75.5 KB

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2008-04-15 08:00:06 Re: libpq Win32 Mutex performance patch
Previous Message Brendan Jurd 2008-04-14 21:23:13 Removing typename from A_Const (was: Empty arrays with ARRAY[])