Tom Lane escribió:
> Alvaro Herrera <[EMAIL PROTECTED]> 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.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to