Re: Nested xacts: looking for testers and review - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Nested xacts: looking for testers and review
Date
Msg-id 20040528185232.GB2343@dcc.uchile.cl
Whole thread Raw
In response to Re: Nested xacts: looking for testers and review  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Responses Re: Nested xacts: looking for testers and review  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Nested xacts: looking for testers and review  (Jan Wieck <JanWieck@Yahoo.com>)
List pgsql-hackers
On Fri, May 28, 2004 at 01:43:16PM -0400, Bruce Momjian wrote:

> In this case, I want to try all of the inserts, but any of them can
> fail, then I want the bottom part done.

I wonder where everyone eas when I asked this question a lot of time
ago.  I said I thought the behavior should be like I described, and no
one objected.

Personally I think it would be a mistake to allow the COMMIT for the
subtransaction to ignore the fact that the subxact was aborted.  However
I realize what you are proposing, and maybe this can be implemented
using a parameter to COMMIT (indicating to not propagate the error if
it's in aborted state, but commit normally otherwise).

However if everyone disagrees, I can take that part out, and the code
would be simpler.  IMHO however, it would be less reliable.


> In my logic, the subtransaction COMMIT is part of the subtransaction and
> should not affect the outer transaction's state.

In some cases yes, but not all.  In others, the outer transaction could
trust that the inner one worked; to make the example you posted work,
I'd use a program rather than a script, and check the return values (or
the transaction state).  If the subxact is in aborted state, issue
ROLLBACK and try again; if not, commit.

> Unfortunately, we don't have any similar behavior in our 7.4 code
> because whether you issue COMMIT or ABORT, it does not affect the outer
> session.

Of course.  This is new functionality.

> Right now I think just posting examples will work fine.  I think the
> above case shows we are not ready for documentation yet.  What I would
> like is for folks to focus on testing so we can find any open issues
> like this one and address them.

Ok.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"In Europe they call me Niklaus Wirth; in the US they call me Nickel's worth.
That's because in Europe they call me by name, and in the US by value!"



pgsql-hackers by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: SELECT * FROM LIMIT 1; is really slow
Next
From: "Matthew T. O'Connor"
Date:
Subject: pg_autovacuum Integration