From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Nested xacts, try 5 |
Date: | 2004-05-23 22:02:12 |
Message-ID: | 20040523220212.GF27973@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
nested-all-5.patch.gz | application/octet-stream | 28.7 KB |
subtrans.c.gz | application/octet-stream | 3.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2004-05-23 22:20:56 | cosmetic psql tweaks |
Previous Message | Tom Lane | 2004-05-23 21:32:36 | Re: Tuple sampling |