Re: Postmaster holding unlinked files for pg_largeobject table

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Kevin Grittner <kevin(dot)grittner(at)wicourts(dot)gov>, alexk <alexk(at)commandprompt(dot)com>, Alexander Shulgin <ash(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Postmaster holding unlinked files for pg_largeobject table
Date: 2011-06-06 16:43:45
Message-ID: BANLkTik9Fe+H=Tv5-kCm5QxrVVSdu1Qc=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Jun 6, 2011 at 12:30 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
>> Excerpts from Tom Lane's message of lun jun 06 12:10:24 -0400 2011:
>>> Yeah, I wasn't that thrilled with the suggestion either.  But we can't
>>> just have backends constantly closing every open FD they hold, or
>>> performance will suffer.  I don't see any very good place to do this...
>
>> How about doing something on an sinval message for pg_database?
>> That doesn't solve the WAL problem Kevin found, of course ...
>
> Hmm ... that would help for the specific scenario of dropped databases,
> but we've also heard complaints about narrower cases such as a single
> dropped table.
>
> A bigger issue is that I don't believe it's very practical to scan the
> FD array looking for files associated with a particular database (or
> table).  They aren't labeled that way, and parsing the file path to
> find out the info seems pretty grotty.
>
> On reflection I think this behavior is probably limited to the case
> where we've done what we used to call a "blind write" of a block that
> is unrelated to our database or tables.  For normal SQL-driven accesses,
> there's a relcache entry, and flushing of that entry will lead to
> closure of associated files.  I wonder whether we should go back to
> forcibly closing the FD after a blind write.  This would suck if a
> backend had to do many dirty-buffer flushes for the same relation,
> but hopefully the bgwriter is doing most of those.  We'd want to make
> sure such forced closure *doesn't* occur in the bgwriter.  (If memory
> serves, it has a checkpoint-driven closure mechanism instead.)

Instead of closing them immediately, how about flagging the FD and
closing all the flagged FDs at the end of each query, or something
like that?

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-06-06 16:49:46 Re: Postmaster holding unlinked files for pg_largeobject table
Previous Message Tom Lane 2011-06-06 16:30:25 Re: Postmaster holding unlinked files for pg_largeobject table

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2011-06-06 16:45:06 Re: Range Types and extensions
Previous Message Tom Lane 2011-06-06 16:30:25 Re: Postmaster holding unlinked files for pg_largeobject table