aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/file/fd.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-10-17 23:09:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-10-17 23:09:02 +0000
commite1c76c25336834b89dac146ccf719c08a0d08b4c (patch)
tree4bdc4f78b9f55c5251b67a9ca5214b0e42de1c2c /src/backend/storage/file/fd.c
parent887afac1f59e2b69a8bbbdac6d13ff288042e855 (diff)
downloadpostgresql-e1c76c25336834b89dac146ccf719c08a0d08b4c.tar.gz
postgresql-e1c76c25336834b89dac146ccf719c08a0d08b4c.zip
Change fd.c so that temp files are closed and deleted at
proc_exit time. I discovered that if the frontend closes the connection when you're inside a transaction block, there is nothing ensuring that temp files go away ... I wonder whether proc_exit ought to try to do an explicit transaction abort?
Diffstat (limited to 'src/backend/storage/file/fd.c')
-rw-r--r--src/backend/storage/file/fd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 2fce82ecfd6..8dc82844d5e 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.49 1999/10/13 15:02:29 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.50 1999/10/17 23:09:02 tgl Exp $
*
* NOTES:
*
@@ -48,6 +48,7 @@
#include "postgres.h"
#include "miscadmin.h"
#include "storage/fd.h"
+#include "storage/ipc.h"
/*
* Problem: Postgres does a system(ld...) to do dynamic loading.
@@ -442,6 +443,9 @@ AllocateVfd()
VfdCache->fd = VFD_CLOSED;
SizeVfdCache = 1;
+
+ /* register proc-exit call to ensure temp files are dropped at exit */
+ on_proc_exit(AtEOXact_Files, NULL);
}
if (VfdCache[0].nextFree == 0)
@@ -985,10 +989,10 @@ closeAllVfds()
/*
* AtEOXact_Files
*
- * This routine is called during transaction commit or abort (it doesn't
- * particularly care which). All still-open temporary-file VFDs are closed,
- * which also causes the underlying files to be deleted. Furthermore,
- * all "allocated" stdio files are closed.
+ * This routine is called during transaction commit or abort or backend
+ * exit (it doesn't particularly care which). All still-open temporary-file
+ * VFDs are closed, which also causes the underlying files to be deleted.
+ * Furthermore, all "allocated" stdio files are closed.
*/
void
AtEOXact_Files(void)