Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 2D514632660 for ; Sun, 15 Aug 2010 15:58:18 -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 35858-02 for ; Sun, 15 Aug 2010 18:58:10 +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 2715B632629 for ; Sun, 15 Aug 2010 15:58:11 -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 o7FIwAHn003093 for ; Sun, 15 Aug 2010 14:58:10 -0400 (EDT) To: pgsql-hackers@postgreSQL.org Subject: DropRelFileNodeBuffers API change (was Re: [BUGS] BUG #5599: Vacuum fails due to index corruption issues) In-reply-to: <1880.1281020817@sss.pgh.pa.us> References: <201008042147.o74LlCge057659@wwwmaster.postgresql.org> <1280978913-sup-5475@alvh.no-ip.org> <8B7319E089E48047A0B688CE9CF54FD855C3C916@USRES8MAIL.asg.com> <1880.1281020817@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 05 Aug 2010 11:06:57 -0400" Date: Sun, 15 Aug 2010 14:58:10 -0400 Message-ID: <3092.1281898690@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/1033 X-Sequence-Number: 167836 In the discussion of bug #5599 we pretty much agreed to do this: > Seems like we need to think harder about recovering from a truncate > failure. A few random ideas: > 1. Write the dirty buffers before dropping them. Kind of ugly from a > performance viewpoint, but simple and safe. I looked at making this happen, and noted that DropRelFileNodeBuffers is used both for the truncation case and for dropping relation buffers during smgrdounlink. In the latter case, it's still appropriate to drop dirty buffers without writing them, both for performance reasons and because we don't really care about any errors: we have already committed the relation DROP, and are not going to look at the file contents again in any case. So this means that two different behaviors are now required for truncation and dropping. The cleanest fix is an API change to add a boolean write-or-not parameter to DropRelFileNodeBuffers. That's what I want to do in HEAD and 9.0, but I'm unsure whether it's a safe fix in the back branches. Does anyone have an opinion whether it's likely that any third-party code is calling DropRelFileNodeBuffers directly? If there is, then changing its API in a minor release would be an unfriendly thing to do. We could avoid that by some ugly expedient like inserting a second copy of the function in back branches. Comments? regards, tom lane