Thread: Nested transactions, 1st try

Nested transactions, 1st try

From
Alvaro Herrera
Date:
Hackers,

Sorry for taking so long.  Hopefully next iterations will be quicker.

This is the first attempt at supporting nested transactions.  Mainly,
some global per-transaction structures have been converted into stacks
or something equivalent.  These are:
- deferred triggers
- snapshot data
- smgr pending deletes

Also, LWLocks are marked with a transaction ID that should allow
releasing a child transaction lock's all together, without releasing its
parent's.

Lastly, there's transaction block state support.

There are a lot of things missing, tuple visibility rules being the most
obvious.  This passes the regression tests, but in no way the semantics
of subtransactions are correct.  I post this so people can look at the
approaches taken and say whether they are right or wrong.

For example, this works:

BEGIN;
    BEGIN;
        CREATE TABLE foo (one int);
    ROLLBACK;
    CREATE TABLE bar (two int);
COMMIT;
(only table bar is created)

But this doesn't:

BEGIN;
    CREATE TABLE bar (two int);
    BEGIN;
        CREATE TABLE foo (one int);
    ROLLBACK;
COMMIT;
(no table is created).

I will continue working on this.  Comments are very much welcome.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The first of April is the day we remember what we are
the other 364 days of the year"  (Mark Twain)

Attachment

Re: Nested transactions, 1st try

From
Manfred Koizar
Date:
Alvaro,

> This is the first attempt at supporting nested transactions.

I found your patch here:
http://archives.postgresql.org/pgsql-patches/2003-04/msg00086.php,
more or less by chance because normally I read -patches through the
news server, but ISTM something's wrong there.  There is only one
message in comp.databases.postgresql.patches since 2003-03-26.

I don't know what else I missed.  Has there been a specification of
the interface between the low level stuff I'm supposed to implement
and the area you are working in?

I'm extracting your patch from the web page now and hope to find some
time to play around with it, when I'm on vacation (skiing) next week.

Servus
 Manfred


Re: Nested transactions, 1st try

From
Alvaro Herrera
Date:
On Fri, Apr 18, 2003 at 11:55:17AM +0200, Manfred Koizar wrote:

> > This is the first attempt at supporting nested transactions.

> I don't know what else I missed.  Has there been a specification of
> the interface between the low level stuff I'm supposed to implement
> and the area you are working in?

No, there isn't any spec on that.  ISTM the whole of
access/transam/transam.c should be rewritten with nested transactions in
mind.  I'll look at that.  I wanted to know if the hacker team likes the
approach taken to "globalize" the structures before I continue working
with them.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La principal característica humana es la tontería"
(Augusto Monterroso)