On Thu, Apr 29, 2004 at 11:38:52PM +0100, Simon Riggs wrote:
> On Sun, 2004-04-25 at 19:06, Alvaro Herrera wrote:
> > - pg_clog/pg_subtrans. Need a solution.
> As you're aware, our current work overlaps.
> pg_clog doesn't seem like the place to record subtransactions, though
> maybe it is... could we not give subtransactions a txnid just as with
> flat transactions? That way we can record everything in pg_clog AND
> recovery will work without further modification - as long as the failure
> of a top level transaction causes failure of every subtransaction EVEN
> if the subtrans originally committed.
> If you add pg_subtrans, you will need to make recovery work all over
> again...really, you don't want to be doing that, do you?
I'm not sure if I follow you. I suppose you haven't read the previous
discussions on this issue. pg_subtrans will have, for each Xid, the Xid
of its parent xact; if it's toplevel (as all xacts are implicitly in the
current implementation), it will have 0. In pg_clog, a committed
subxact will be marked with 11; committed top-level xact will still be
10. Aborted xact (toplevel and subxact) will have 01.
So whenever you see a xact with 10 in pg_clog, you know it committed.
Whenever you see 11, you know you have to fetch pg_subtrans and check
its parent (which could in turn be 11 so you have to recurse; or 10 so
you know it's committed; or 01 so you know if it's aborted; or 00 so you
know it's in progress).
After "a suitable time" (after the parent xact commits) the 11 can be
changed to 10.
I don't think there's really a change in how recovery works. There
will likely be more traffic to pg_xlog involving writes to pg_clog and
pg_subtrans but it shouldn't affect much, should it?
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Linux transformó mi computadora, de una `máquina para hacer cosas',
en un aparato realmente entretenido, sobre el cual cada día aprendo
algo nuevo" (Jaime Salinas)
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster