Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite1c76c2

Browse files
committed
Change fd.c so that temp files are closed and deleted at
proc_exit time. I discovered that if the frontend closes the connectionwhen you're inside a transaction block, there is nothing ensuring thattemp files go away ... I wonder whether proc_exit ought to try to do anexplicit transaction abort?
1 parent887afac commite1c76c2

File tree

1 file changed

+9
-5
lines changed
  • src/backend/storage/file

1 file changed

+9
-5
lines changed

‎src/backend/storage/file/fd.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 1994, Regents of the University of California
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.49 1999/10/13 15:02:29 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.50 1999/10/17 23:09:02 tgl Exp $
1010
*
1111
* NOTES:
1212
*
@@ -48,6 +48,7 @@
4848
#include"postgres.h"
4949
#include"miscadmin.h"
5050
#include"storage/fd.h"
51+
#include"storage/ipc.h"
5152

5253
/*
5354
* Problem: Postgres does a system(ld...) to do dynamic loading.
@@ -442,6 +443,9 @@ AllocateVfd()
442443
VfdCache->fd=VFD_CLOSED;
443444

444445
SizeVfdCache=1;
446+
447+
/* register proc-exit call to ensure temp files are dropped at exit */
448+
on_proc_exit(AtEOXact_Files,NULL);
445449
}
446450

447451
if (VfdCache[0].nextFree==0)
@@ -985,10 +989,10 @@ closeAllVfds()
985989
/*
986990
* AtEOXact_Files
987991
*
988-
* This routine is called during transaction commit or abort(it doesn't
989-
* particularly care which). All still-open temporary-file VFDs are closed,
990-
* which also causes the underlying files to be deleted. Furthermore,
991-
* all "allocated" stdio files are closed.
992+
* This routine is called during transaction commit or abortor backend
993+
*exit (it doesn'tparticularly care which). All still-open temporary-file
994+
*VFDs are closed,which also causes the underlying files to be deleted.
995+
*Furthermore,all "allocated" stdio files are closed.
992996
*/
993997
void
994998
AtEOXact_Files(void)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp