Nested xacts, try 5 - Mailing list pgsql-patches

From Alvaro Herrera
Subject Nested xacts, try 5
Date
Msg-id 20040523220212.GF27973@dcc.uchile.cl
Whole thread Raw
List pgsql-patches
Hackers,

I attach a updated nested transactions patch.  Hopefully the list server
will actually distribute it this time.  I'd really like to get some
testing and comment.  Does this actually work on the scenarios where
those of you who would be using it expect it to work?

In this patch, relcache and catcache reference counting is handled as
previously discussed on pgsql-hackers: each item carries a stack onto
which the current refcount is pushed when a subtransaction starts, and
it is restored if the subtransaction aborts.  This is a "first cut" and
probably there some bug in the logic, but the basic cases work.

Also, Locks are released on subtrans abort based on the list of
committed child transactions, rather than relabeling at subtrans commit;
I suspect it's cheaper as we don't have to rehash the lock with the new
tag.

Main transaction commit and abort are logged with a list of committed
subtransactions.  At recovery, those are marked committed or aborted.

I added some logic to the pg_subtrans code so that a subcommitted
transaction whose parent is either committed or aborted (recursively) is
marked as committed/aborted if its Xid is lesser than a cutoff point.
The cutoff is taken from the xmin calculated at GetSnapshotData, so by
the time pg_clog is modified, no transaction is running which should see
them as in-progress.  Please comment on this, as the idea is new.  The
change is done in TransactionIdDidCommit() and TransactionIdDidAbort()
(and so the SubtransCutoffXid is kept in transam.c, which may seem
strange but it's actually the only place where it can be).


What's missing:

- deferred trigger handling
- Tom mentioned buffer manager state reversing.  I haven't investigated
  this yet.
- check that relcache and catcache code is correct.  I'm almost sure
  there's a bug.

Hopefully not much else.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Tulio: oh, para qué servirá este boton, Juan Carlos?
Policarpo: No, aléjense, no toquen la consola!
Juan Carlos: Lo apretaré una y otra vez.

Attachment

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Tuple sampling
Next
From: Neil Conway
Date:
Subject: cosmetic psql tweaks