Skip to content

Commit e4f4a7f

Browse files
committed
Remove FileUnlink(), which wasn't being used anywhere and interacted poorly
with the recent patch to log temp file sizes at removal time. Doesn't seem worth fixing since it's unused. In passing, make a few elog messages conform to the message style guide.
1 parent 82eed4d commit e4f4a7f

File tree

2 files changed

+9
-29
lines changed
  • src
    • backend/storage/file
    • include/storage

2 files changed

+9
-29
lines changed

src/backend/storage/file/fd.c

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.139 2007/06/07 19:19:57 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.140 2007/07/26 15:15:18 tgl Exp $
1111
*
1212
* NOTES:
1313
*
@@ -549,8 +549,7 @@ LruDelete(File file)
549549

550550
/* close the file */
551551
if (close(vfdP->fd))
552-
elog(ERROR, "failed to close \"%s\": %m",
553-
vfdP->fileName);
552+
elog(ERROR, "could not close file \"%s\": %m", vfdP->fileName);
554553

555554
--nfile;
556555
vfdP->fd = VFD_CLOSED;
@@ -985,8 +984,7 @@ FileClose(File file)
985984

986985
/* close the file */
987986
if (close(vfdP->fd))
988-
elog(ERROR, "failed to close \"%s\": %m",
989-
vfdP->fileName);
987+
elog(ERROR, "could not close file \"%s\": %m", vfdP->fileName);
990988

991989
--nfile;
992990
vfdP->fd = VFD_CLOSED;
@@ -1005,15 +1003,15 @@ FileClose(File file)
10051003
{
10061004
if (filestats.st_size >= log_temp_files)
10071005
ereport(LOG,
1008-
(errmsg("temp file: path \"%s\" size %lu",
1009-
vfdP->fileName, (unsigned long)filestats.st_size)));
1006+
(errmsg("temp file: path \"%s\" size %lu",
1007+
vfdP->fileName,
1008+
(unsigned long) filestats.st_size)));
10101009
}
10111010
else
1012-
elog(LOG, "Could not stat \"%s\": %m", vfdP->fileName);
1011+
elog(LOG, "could not stat file \"%s\": %m", vfdP->fileName);
10131012
}
10141013
if (unlink(vfdP->fileName))
1015-
elog(LOG, "failed to unlink \"%s\": %m",
1016-
vfdP->fileName);
1014+
elog(LOG, "could not unlink file \"%s\": %m", vfdP->fileName);
10171015
}
10181016

10191017
/*
@@ -1022,23 +1020,6 @@ FileClose(File file)
10221020
FreeVfd(file);
10231021
}
10241022

1025-
/*
1026-
* close a file and forcibly delete the underlying Unix file
1027-
*/
1028-
void
1029-
FileUnlink(File file)
1030-
{
1031-
Assert(FileIsValid(file));
1032-
1033-
DO_DB(elog(LOG, "FileUnlink: %d (%s)",
1034-
file, VfdCache[file].fileName));
1035-
1036-
/* force FileClose to delete it */
1037-
VfdCache[file].fdstate |= FD_TEMPORARY;
1038-
1039-
FileClose(file);
1040-
}
1041-
10421023
int
10431024
FileRead(File file, char *buffer, int amount)
10441025
{

src/include/storage/fd.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.59 2007/06/07 19:19:57 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.60 2007/07/26 15:15:18 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -62,7 +62,6 @@ extern int max_files_per_process;
6262
extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode);
6363
extern File OpenTemporaryFile(bool interXact);
6464
extern void FileClose(File file);
65-
extern void FileUnlink(File file);
6665
extern int FileRead(File file, char *buffer, int amount);
6766
extern int FileWrite(File file, char *buffer, int amount);
6867
extern int FileSync(File file);

0 commit comments

Comments
 (0)