X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF9E4D1B360 for ; Thu, 10 Jun 2004 01:11:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99824-02 for ; Thu, 10 Jun 2004 04:11:30 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id C79D1D1B188 for ; Thu, 10 Jun 2004 01:11:27 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id i5A4BQL14526; Thu, 10 Jun 2004 00:11:26 -0400 (EDT) From: Bruce Momjian Message-Id: <200406100411.i5A4BQL14526@candle.pha.pa.us> Subject: Re: Nested transactions In-Reply-To: <20040608222356.GC13820@dcc.uchile.cl> To: Alvaro Herrera Date: Thu, 10 Jun 2004 00:11:26 -0400 (EDT) Cc: Patches X-Mailer: ELM [version 2.4ME+ PL108 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/96 X-Sequence-Number: 11320 Your patch has been added to the PostgreSQL unapplied patches list at: http://momjian.postgresql.org/cgi-bin/pgpatches I will try to apply it after review. --------------------------------------------------------------------------- Alvaro Herrera wrote: > Hackers, > > Here is the latest installment of the nested transactions patch. > > What's in the current patch: > > - transaction block support. The user can start subtransactions inside > each transaction block and rollback each one independently. The > nesting level has no practical limit, though each transaction tree can > have at most 2^32 commands (subtransaction start counts as one > command). > > - Most subsystems have a cleanup function called at subtransaction > abort: deferred triggers, relcache refcount, catcache refcount, smgr > pending deletes, gist/rtree/hash scan lists, bufmgr refcount, > on-commit actions. > > - SPI closes connections opened during the aborting subtransaction. > > - The lock manager releases locks taken by the aborting subtransaction, > but _holds_ locks taken by a committing subtransaction. This is > needed by MVCC semantics. > > - A special memory context, CommitContext is created for each > subtransaction. It is destroyed if the subtransaction aborts, but > if it commits then it will be kept until main transaction commit > (or its parent subtransaction aborts). > > - The pg_subtrans module is created to keep the parent Xid of each > subtransaction. It's similar (and based on) the pg_clog code. > > - The pg_clog Xlog code was moved to Slru and merged with pg_subtrans > Xlog code. > > - When we wait for a transaction to finish (XactLockTableWait), we > actually wait for the topmost transaction. > > - SET TRANSACTION ISOLATION LEVEL and SET READ ONLY are not allowed > inside a subtransaction. > > What's missing to complete the nested transactions work: > > - Make GUC vars work correctly. > - Lots of testing. > - Documentation > - Optimizations: > * the phantom Xid idea is not implemented here. > * optimize TransactionIdIsInProgress > * profile > - More regression testing. Need additional concurrent infrastructure. > > Many thanks to: > > - Manfred Koizar for making the pg_subtrans code possible and discussion > on several issues. > - Stephan Szabo for the idea on which the deferred trigger code was > based. > - Tom Lane for asking the right questions. > - Bruce Momjian for useful ideas. > > > IMHO this patch should be reviewed and applied to achieve wide testing > as soon as possible before feature freeze. More changes can be applied > later as available/needed. (The patch is already huge and contains > several important changes that need careful review. Adding more to the > mix will only make things more difficult.) > > -- > Alvaro Herrera () > "No single strategy is always right (Unless the boss says so)" > (Larry Wall) [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073