bgwriter holds onto file handles of deleted files

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: bgwriter holds onto file handles of deleted files
Date: 2012-01-07 19:19:04
Message-ID: CAMkU=1z=VZtcy+4GqHyUn7yo_7id+Lo4XDdzYYz3WBD_Zfw2DA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On an overnight test run, I ran into an unexpected "out of space" condition.

The writer process was holding on to dozens of file descriptors for
long-ago deleted files from dropped tables and indexes, preventing
their disk space from being freed for reuse.

I think the checkpoint writer process learns about deleted files from
the "absorb fsync" mechanism and promptly closes those handles. But
since the bgwriter process was split from the checkpoint writer, the
bgwriter no longer benefits from this mechanism.

It looks like it hold the file handles until either is it is killed
and restarted, or until they get flushed out of vfd cache (which holds
~1000 files on my machine, so that can be a long time and lot of disk
space).

I don't know if this is a bug exactly, but it seems pretty unfortunate.

Cheers,

Jeff

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2012-01-07 21:01:26 Re: random_page_cost vs seq_page_cost
Previous Message Alexander Korotkov 2012-01-07 17:36:42 Re: Collect frequency statistics for arrays