diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2011-06-10 13:43:02 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2011-06-10 13:43:02 -0400 |
commit | fba105b1099f4f5fa7283bb17cba6fed2baa8d0c (patch) | |
tree | 5f430842e2309bb35735edb47f5e4ef6451107fd /src/include/storage/fd.h | |
parent | 3d114b63b253605eb60055c910aa2e55c98d5ed2 (diff) | |
download | postgresql-fba105b1099f4f5fa7283bb17cba6fed2baa8d0c.tar.gz postgresql-fba105b1099f4f5fa7283bb17cba6fed2baa8d0c.zip |
Use "transient" files for blind writes, take 2
"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.)
This commit fixes a bug in the previous one, which neglected to cleanly
handle the LRU ring that fd.c uses to manage open files, and caused an
unacceptable failure just before beta2 and was thus reverted.
Diffstat (limited to 'src/include/storage/fd.h')
-rw-r--r-- | src/include/storage/fd.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index dc0aada35bc..8a4d07c5533 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -61,6 +61,7 @@ extern int max_files_per_process; /* Operations on virtual Files --- equivalent to Unix kernel file ops */ extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode); extern File OpenTemporaryFile(bool interXact); +extern void FileSetTransient(File file); extern void FileClose(File file); extern int FilePrefetch(File file, off_t offset, int amount); extern int FileRead(File file, char *buffer, int amount); |