pgsql: Use "transient" files for blind writes

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use "transient" files for blind writes
Date: 2011-06-09 20:26:29
Message-ID: E1QUloD-0002jA-9X@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Use "transient" files for blind writes

"Blind writes" are a mechanism to push buffers down to disk when
evicting them; since they may belong to different databases than the one
a backend is connected to, the backend does not necessarily have a
relation to link them to, and thus no way to blow them away. We were
keeping those files open indefinitely, which would cause a problem if
the underlying table was deleted, because the operating system would not
be able to reclaim the disk space used by those files.

To fix, have bufmgr mark such files as transient to smgr; the lower
layer is allowed to close the file descriptor when the current
transaction ends. We must be careful to have any other access of the
file to remove the transient markings, to prevent unnecessary expensive
system calls when evicting buffers belonging to our own database (which
files we're likely to require again soon.)

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/54d9e8c6c19cbefa8fb42ed3442a0a5327590ed3

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 10 +++-
src/backend/storage/file/fd.c | 108 ++++++++++++++++++++++++++--------
src/backend/storage/smgr/md.c | 9 +++
src/backend/storage/smgr/smgr.c | 17 ++++++
src/include/storage/fd.h | 1 +
src/include/storage/smgr.h | 2 +
6 files changed, 119 insertions(+), 28 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2011-06-09 20:43:05 pgsql: Revert "Use "transient" files for blind writes"
Previous Message Peter Eisentraut 2011-06-09 20:08:20 pgsql: Translation updates for 9.1beta2

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-06-09 20:33:25 Re: SSI work for 9.1
Previous Message Alvaro Herrera 2011-06-09 20:02:14 Re: Postmaster holding unlinked files for pg_largeobject table