Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id DFF05B5DBC4 for ; Mon, 26 Sep 2011 21:33:16 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73908-07 for ; Tue, 27 Sep 2011 00:33:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from lists.commandprompt.com (host-215.commandprompt.net [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 4E1F5B5DBF2 for ; Mon, 26 Sep 2011 21:33:10 -0300 (ADT) Received: from perhan.alvh.no-ip.org (spinlock.commandprompt.com.commandprompt.com [207.173.203.215]) by lists.commandprompt.com (Postfix) with ESMTPA id 15BC534C3A1; Mon, 26 Sep 2011 17:33:07 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([200.126.68.131] helo=perhan.alvh.no-ip.org) by assp.commandprompt.com with ESMTP (2.0.1); 26 Sep 2011 17:33:04 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 411786E364; Mon, 26 Sep 2011 21:33:03 -0300 (CLST) Content-Type: text/plain; charset=UTF-8 Cc: yamt , pgsql-hackers Subject: Re: [BUGS] BUG #6218: TRAP: FailedAssertion( "!(owner->nsnapshots == 0)", File: "resowner.c", Line: 365) From: Alvaro Herrera To: Tom Lane In-reply-to: <6382.1317081585@sss.pgh.pa.us> References: <5291.1316980809@sss.pgh.pa.us> <20110926100653.4D3BC14A143@mail.netbsd.org> <8244.1317054397@sss.pgh.pa.us> <1317070986-sup-4844@alvh.no-ip.org> <2126.1317073572@sss.pgh.pa.us> <6382.1317081585@sss.pgh.pa.us> Date: Mon, 26 Sep 2011 21:33:03 -0300 Message-Id: <1317083058-sup-9596@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Assp-Version: 2.0.1(3.2.15) on assp.commandprompt.com X-Assp-Client-TLS: yes X-Assp-ID: assp.commandprompt.com m1-83587-02825 X-Assp-Original-Subject: Re: [BUGS] BUG #6218: TRAP: FailedAssertion( "!(owner->nsnapshots == 0)", File: "resowner.c", Line: 365) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201109/1431 X-Sequence-Number: 195620 Excerpts from Tom Lane's message of lun sep 26 20:59:45 -0300 2011: > Well, I soon ran into the issue that delaying the snapshot release makes > TopTransactionResourceOwner spit up. After some reflection I decided > that the real problem is a circular dependency: snapshot management must > be considered lower-level than ResourceOwners because ResourceOwners > tell snapshot management what to do, but here we have > GetTransactionSnapshot trying to use TopTransactionResourceOwner to > manage its internal reference to the transaction snapshot. Great. I noticed the circularity but didn't reflect that it was bogus in itself. > Accordingly, the attached proposed patch gets rid of the circularity > by removing snapmgr.c's dependency on TopTransactionResourceOwner, > in favor of having it track the refcount "manually". This was messier > than I'd hoped because the bogus design had propagated into the SSI > manager meanwhile, but removing the TopTransactionResourceOwner > dependency from that too seems like a good idea. To be honest, I panicked for a second when I saw the new SnapshotResetXmin call, before I realized that it wasn't necessary before. The serializable case makes more sense the patched way, I think. > This passes the regular and isolation regression tests, and it's also > okay with Yamamoto-san's prepared-ROLLBACK test case even without the > band-aid fix in plancache.c. I can't immediately think of any other > test cases to throw at it. I added tests for all the problematic cases discovered after snapmgr was introduced, so at least most known weird spots are covered. Thanks -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support