Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2149A6321F7 for ; Sun, 15 Aug 2010 22:26:08 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 56746-03 for ; Mon, 16 Aug 2010 01:25:55 +0000 (UTC) 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 5019D6321D5 for ; Sun, 15 Aug 2010 22:25:56 -0300 (ADT) 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 o7G1PsZh010049; Sun, 15 Aug 2010 21:25:54 -0400 (EDT) To: Robert Haas cc: pgsql-hackers@postgresql.org Subject: Re: DropRelFileNodeBuffers API change (was Re: [BUGS] BUG #5599: Vacuum fails due to index corruption issues) In-reply-to: References: <201008042147.o74LlCge057659@wwwmaster.postgresql.org> <1280978913-sup-5475@alvh.no-ip.org> <8B7319E089E48047A0B688CE9CF54FD855C3C916@USRES8MAIL.asg.com> <1880.1281020817@sss.pgh.pa.us> <3092.1281898690@sss.pgh.pa.us> <5884.1281908348@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Sun, 15 Aug 2010 21:11:10 -0400" Date: Sun, 15 Aug 2010 21:25:54 -0400 Message-ID: <10048.1281921954@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/1051 X-Sequence-Number: 167854 Robert Haas writes: > Oh, sorry. I was thinking we were talking about complete truncation > rather than partial truncation. I'm still pretty unhappy with the > proposed fix, though, because it gives up performance in a broad range > of cases to cater to an extremely narrow failure case. It doesn't matter: broken is broken, and failure to recover from a truncate() error is broken. You mustn't think that this is a Windows-only problem. > Considering > the rarity of the proposed problem, are we sure that it isn't better > to adopt a solution like what Heikki proposed? If truncation fails, > try to zero the pages; if that also fails, PANIC. ... and PANIC is absolutely, entirely, 100% unacceptable here. I don't think you understand the context. We've already written the truncate action to WAL (as we must: WAL before data change). If we PANIC, that means we'll PANIC again during WAL replay. So that solution means a down, and perhaps unrecoverably broken, database. There's also the little problem that "zero the page" is only a safe recovery action for heap pages not index pages; smgrtruncate is certainly not entitled to assume its working on a heap. I think the performance argument is based on fear not facts anyway. In practice, in modern installations, you're only going to be talking about marginally more work in autovacuum. ISTM we should fix the bug, in a simple/reliable/backpatchable way, and then anyone who's worried about performance can measure the size of the problem, and try to think of a workable solution if he doesn't like the results. regards, tom lane