Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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: snapshot-5.patch
Description: text/x-diff (75.5 KB)

In response to

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group