pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: DropRelFileNodeBuffers API change (was Re: [BUGS] BUG #5599: Vacuum fails due to index corruption issues)
Date: Sun, 15 Aug 2010 17:17:50 -0400
Message-ID: <AANLkTimcna8WUNfEGpAzpp5PEJ5pX+zP072NJXWTaN-D@mail.gmail.com> (raw)
In-Reply-To: <3092.1281898690@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>
	<3092.1281898690@sss.pgh.pa.us>

On Sun, Aug 15, 2010 at 2:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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?

I really hate this solution, because writing out data that we're about
to throw away just in case we can't actually throw it away seems like
a real waste from a performance standpoint.  Could we avoid this
altogether by allocating a new relfilenode on truncate?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company



view thread (21+ messages)  latest in thread

Message-ID: <AANLkTimcna8WUNfEGpAzpp5PEJ5pX+zP072NJXWTaN-D@mail.gmail.com>
Permalink:  ../AANLkTimcna8WUNfEGpAzpp5PEJ5pX+zP072NJXWTaN-D@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTimcna8WUNfEGpAzpp5PEJ5pX+zP072NJXWTaN-D@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: robertmhaas@gmail.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: DropRelFileNodeBuffers API change (was Re: [BUGS] BUG #5599: Vacuum fails due to index corruption issues)
  In-Reply-To: <AANLkTimcna8WUNfEGpAzpp5PEJ5pX+zP072NJXWTaN-D@mail.gmail.com>
  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> <AANLkTimcna8WUNfEGpAzpp5PEJ5pX+zP072NJXWTaN-D@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox