X-Original-To: pgsql-hackers-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D38019FA148 for ; Wed, 13 Sep 2006 22:45:51 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 37591-03 for ; Wed, 13 Sep 2006 22:45:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 27FF49F9EF0 for ; Wed, 13 Sep 2006 22:45:46 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k8E1jZvB022081; Wed, 13 Sep 2006 21:45:35 -0400 (EDT) To: Alvaro Herrera cc: ITAGAKI Takahiro , Bruce Momjian , pgsql-hackers@postgresql.org Subject: Re: CSStorm occurred again by postgreSQL8.2 In-reply-to: <13251.1157299738@sss.pgh.pa.us> References: <20060808110913.50FA.ITAGAKI.TAKAHIRO@oss.ntt.co.jp> <200608260346.k7Q3k2g06954@momjian.us> <20060828181312.5638.ITAGAKI.TAKAHIRO@oss.ntt.co.jp> <13251.1157299738@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 03 Sep 2006 12:08:58 -0400" Date: Wed, 13 Sep 2006 21:45:35 -0400 Message-ID: <22080.1158198335@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.108 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/1074 X-Sequence-Number: 90603 I wrote: > ... it seems like in the > case where RecordSubTransactionCommit detects that the subxact has not > stored its XID anywhere, we could immediately remove the XID from > the PGPROC array, just as if it had aborted. This would avoid chewing > subxid slots for cases such as exception blocks in plpgsql that are > not modifying the database, but just catching computational errors. (and later realized that Alvaro had had the same idea awhile back, but I don't have his message at hand). I looked into this a bit more; it seems like basically it should only take addition of else XidCacheRemoveRunningXids(xid, 0, NULL); to the bottom of RecordSubTransactionCommit(), plus suitable adjustment of the comments in both routines. However, there's a problem: if we delete a second-level subxact's XID from PGPROC, and later its upper subtransaction aborts, XidCacheRemoveRunningXids will emit scary warnings when it doesn't find the sub-subxact in PGPROC. This could doubtless be fixed with sufficient jiggery-pokery --- simply removing the debug warnings would be a brute-force answer, but I'd like to find something a bit less brute-force. Maybe drop the sub-subxact from its parent's list immediately, instead of carrying it forward? Anyway, given that there's this one nonobvious gotcha, there might be others. My recommendation is that we take this off the open-items list for 8.2 and revisit it in the 8.3 cycle when there's more time. regards, tom lane