bgwriter holds onto file handles of deleted files - Mailing list pgsql-hackers

From Jeff Janes
Subject bgwriter holds onto file handles of deleted files
Date
Msg-id CAMkU=1z=VZtcy+4GqHyUn7yo_7id+Lo4XDdzYYz3WBD_Zfw2DA@mail.gmail.com
Whole thread Raw
Responses Re: bgwriter holds onto file handles of deleted files  (Simon Riggs <simon@2ndQuadrant.com>)
List 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


pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: Collect frequency statistics for arrays
Next
From: Peter Eisentraut
Date:
Subject: Re: random_page_cost vs seq_page_cost