Re: [WIP] Keeping track of snapshots

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Pg Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [WIP] Keeping track of snapshots
Date: 2008-03-28 15:03:49
Message-ID: 20080328150349.GN7464@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Gregory Stark wrote:
> "Alvaro Herrera" <alvherre(at)commandprompt(dot)com> writes:
>
> > The other question is about CommitTransactionCommand. Currently my
> > EOXact routine barfs for every snapshot not unregistered on main
> > transaction commit -- a leak. I see this as a good thing, however it
> > forced me to be more meticulous about not having ActiveSnapshot be set
> > in commands that have multiple transactions like VACUUM, multitable
> > CLUSTER and CREATE INDEX CONCURRENTLY.
>
> I believe ActiveSnapshot has to be set during CREATE INDEX CONCURRENTLY if
> it's an expression index which calls a function which needs a snapshot...

Yeah, it is set at that point -- it is unset just before
CommitTransactionCommand is called. Same for multitable CLUSTER -- it
certainly does need a snapshot, but it needs to unregister it just
before committing at the end of processing each table.

> AFAICT VACUUM had better not ever need a snapshot because its xmin isn't
> included in other vacuum commands' globalxmin so there's no guarantee that if
> it had a snapshot that the tuples visible in that snapshot wouldn't disappear
> out from under it.

Yeah, I neglected to mention that this is just for VACUUM FULL (which
does have its xmin included in snapshots).

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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-03-28 15:22:46 Re: [PATCHES] Incomplete docs for restore_command for hotstandby
Previous Message Heikki Linnakangas 2008-03-28 15:01:33 Re: [PATCHES] Incomplete docs for restore_command for hotstandby