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

Re: [subxacts] Savepoint syntax

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [subxacts] Savepoint syntax
Date: 2004-07-18 05:48:30
Message-ID: 20040718054830.GC3449@dcc.uchile.cl (view raw or flat)
Thread:
Lists: pgsql-patches
Here is the second version of the savepoint syntax patch.  This is
almost the same as before; it was changed to apply to current CVS tip.
The description below fits the patch.

One minor thing I noticed is that I can crash the server using

BEGIN;
	DECLARE c CURSOR FOR SELECT unique2/0 FROM tenk1;
	rollback to foo;
COMMIT;

It dies failing the Assert() on resowner.c line 321,
ResourceOwnerDelete() which is !(owner == CurrentResourceOwner)

Apparently this is because it tries to delete the ResourceOwner of the
previous unnamed portal to start it again, while it's still
CurrentResourceOwner.  Not sure if this can happen on clean current
sources.  This isn't tested by regression tests; I discovered it by
chance.  Not sure what is the correct fix for this.

Other than that, everything is OK.

> After the last holy war on syntax issues I have been convinced that
> savepoints are not that brain dead as it appears.  (They nest correctly
> and "release" is equivalent to my "subcommit").  The only bitter point
> is that on ROLLBACK TO the same savepoint is created again
> automatically.
> 
> So I have dropped the idea of the propietary syntax.  This patch
> implements proper savepoint syntax.  Includes regression tests but no
> documentation is provided yet.
> 
> Note that this does not include other patches I'm working on, regarding
> PGPROC, the password file, large objects, whole-tree abort on deadlock,
> handling of subxacts in functions etc.  I'll submit those separately.
> (It does include reverting XactLockTableWait to the previous state
> though).
> 
> Note that I created a new ERRCODE class, 3B000, "Savepoint Exception",
> with a single member, "Invalid Specification" 3B001.  This is what the
> standard mandates when you RELEASE a non existant savepoint, etc.  Hope
> this is OK.  Also, you can't create or release a savepoint on aborted
> state (only COMMIT, END, ROLLBACK and ROLLBACK TO are accepted).
> 
> Please test, review and apply.  If anyone is able to crash the server
> using this I'll be most interested.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The only difference is that Saddam would kill you on private, where the
Americans will kill you in public" (Mohammad Saleh, 39, a building contractor)

pgsql-patches by date

Next:From: Mark KirkwoodDate: 2004-07-18 05:50:11
Subject: PITR COPY Failure (was Point in Time Recovery)
Previous:From: Tom LaneDate: 2004-07-18 05:04:43
Subject: Re: [HACKERS] Point in Time Recovery

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