mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
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?
This commit is contained in:
parent
887afac1f5
commit
e1c76c2533
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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:
|
* NOTES:
|
||||||
*
|
*
|
||||||
@ -48,6 +48,7 @@
|
|||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
#include "storage/fd.h"
|
#include "storage/fd.h"
|
||||||
|
#include "storage/ipc.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Problem: Postgres does a system(ld...) to do dynamic loading.
|
* Problem: Postgres does a system(ld...) to do dynamic loading.
|
||||||
@ -442,6 +443,9 @@ AllocateVfd()
|
|||||||
VfdCache->fd = VFD_CLOSED;
|
VfdCache->fd = VFD_CLOSED;
|
||||||
|
|
||||||
SizeVfdCache = 1;
|
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)
|
if (VfdCache[0].nextFree == 0)
|
||||||
@ -985,10 +989,10 @@ closeAllVfds()
|
|||||||
/*
|
/*
|
||||||
* AtEOXact_Files
|
* AtEOXact_Files
|
||||||
*
|
*
|
||||||
* This routine is called during transaction commit or abort (it doesn't
|
* This routine is called during transaction commit or abort or backend
|
||||||
* particularly care which). All still-open temporary-file VFDs are closed,
|
* exit (it doesn't particularly care which). All still-open temporary-file
|
||||||
* which also causes the underlying files to be deleted. Furthermore,
|
* VFDs are closed, which also causes the underlying files to be deleted.
|
||||||
* all "allocated" stdio files are closed.
|
* Furthermore, all "allocated" stdio files are closed.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
AtEOXact_Files(void)
|
AtEOXact_Files(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user