Re: Snapshot warning

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Snapshot warning
Date: 2008-11-25 16:50:38
Message-ID: 20081125165038.GK4875@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane escribió:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > Tom Lane escribió:
> >> I think the fundamental bug here is that you tried to skip using the
> >> ResourceOwner mechanism for snapshot references. That's basically
> >> not gonna work.
>
> > Right :-( I'll see how to go about this.
>
> It strikes me that you might be able to remove the registered-snapshot
> infrastructure in snapmgr.c, and end up with about the same amount of
> code overall, just with the responsibility in resowner.c.

Seems to work, and fixes Pavan test case as well.

$ runpg 00head showdiff | diffstat
backend/utils/resowner/resowner.c | 99 ++++++++++++++++++++
backend/utils/time/snapmgr.c | 180 ++++++-------------!!!!!!!!!!!!!!!!!
include/utils/resowner.h | 8 +
include/utils/snapmgr.h | 3
4 files changed, 143 insertions(+), 59 deletions(-), 88 modifications(!)

I need to fix some comments before publishing the patch.

The only thing I'm now missing is SnapshotResetXmin(). It currently
looks like this:

static void
SnapshotResetXmin(void)
{
if (RegisteredSnapshotList == NULL && ActiveSnapshot == NULL)
MyProc->xmin = InvalidTransactionId;
}

After the patch we don't have any way to detect whether resowner.c has
any snapshot still linked to. I assume there's no objection to adding a
new entry point in resowner.c for this.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-11-25 17:01:39 Re: Snapshot warning
Previous Message Devrim GÜNDÜZ 2008-11-25 16:46:00 [Fwd: error compiling postgresql with fedora mingw]