Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0C43E63225E for ; Fri, 13 Feb 2009 12:19:11 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 40774-03 for ; Fri, 13 Feb 2009 12:19:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id C984F632ECD for ; Fri, 13 Feb 2009 12:19:07 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n1DGJ1fr003162; Fri, 13 Feb 2009 11:19:01 -0500 (EST) To: John Lister cc: pgsql-hackers@postgresql.org Subject: Re: Database corruption help In-reply-to: <49952D33.3000707@kickstone.com> References: <507152DDF8AB4DF093BD01A8BEC7C659@squarepi.com> <17205.1234200693@sss.pgh.pa.us> <4990840C.4090900@kickstone.com> <20151.1234208044@sss.pgh.pa.us> <49908D72.7040904@kickstone.com> <25753.1234224090@sss.pgh.pa.us> <4991338B.704@kickstone.com> <4994906B.6090408@kickstone.com> <17204.1234474784@sss.pgh.pa.us> <4994987F.1030204@kickstone.com> <17764.1234476783@sss.pgh.pa.us> <4994A45B.4030707@kickstone.com> <49952D33.3000707@kickstone.com> Comments: In-reply-to John Lister message dated "Fri, 13 Feb 2009 08:20:03 +0000" Date: Fri, 13 Feb 2009 11:19:00 -0500 Message-ID: <3161.1234541940@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/763 X-Sequence-Number: 134053 John Lister writes: > Originally in psql-admin, but copied here at the request of Tom to.. Thanks for forwarding this. The reason I wanted to call it to the attention of pgsql-hackers is that the page contents seem a bit odd, and I'm not sure that we should just write it off as "pilot error". What we've got here is a page full of transient states of the pg_class row for temp_queue, which as you explained is constantly being re-TRUNCATEd by your application. So the data contents of each state of the row vary only in relfilenode, as expected. One would also expect that all the copies on a particular page of pg_class would form a single HOT chain (the database is 8.3.5). What we've actually got is a chain that is broken in two places and lacks a root tuple(!). How could it have got that way? John's ill-advised removal of the transaction logs should have resulted only in the page being a lot older than it should be, not in a logically corrupt page. The only other corruption mechanism I can think of is that pg_clog might contain commit bits for some logically inconsistent set of transaction numbers, due to some pages of pg_clog having made it to disk and others not. That could result in some of the intermediate tuples in the chain not being seen as dead --- but that's not what we see here either. Aside from the "how did this happen" puzzle, the real point of any investigation of course ought to be whether we can make heap_page_prune more robust. At the very least it's undesirable to be leaving the page in a state where VACUUM FULL will decide it can't shrink. Ideas anyone? regards, tom lane