Commit e4f4a7f5 authored by Tom Lane's avatar Tom Lane

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.
parent 82eed4db
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.139 2007/06/07 19:19:57 tgl Exp $ * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.140 2007/07/26 15:15:18 tgl Exp $
* *
* NOTES: * NOTES:
* *
...@@ -549,8 +549,7 @@ LruDelete(File file) ...@@ -549,8 +549,7 @@ LruDelete(File file)
/* close the file */ /* close the file */
if (close(vfdP->fd)) if (close(vfdP->fd))
elog(ERROR, "failed to close \"%s\": %m", elog(ERROR, "could not close file \"%s\": %m", vfdP->fileName);
vfdP->fileName);
--nfile; --nfile;
vfdP->fd = VFD_CLOSED; vfdP->fd = VFD_CLOSED;
...@@ -985,8 +984,7 @@ FileClose(File file) ...@@ -985,8 +984,7 @@ FileClose(File file)
/* close the file */ /* close the file */
if (close(vfdP->fd)) if (close(vfdP->fd))
elog(ERROR, "failed to close \"%s\": %m", elog(ERROR, "could not close file \"%s\": %m", vfdP->fileName);
vfdP->fileName);
--nfile; --nfile;
vfdP->fd = VFD_CLOSED; vfdP->fd = VFD_CLOSED;
...@@ -1005,15 +1003,15 @@ FileClose(File file) ...@@ -1005,15 +1003,15 @@ FileClose(File file)
{ {
if (filestats.st_size >= log_temp_files) if (filestats.st_size >= log_temp_files)
ereport(LOG, ereport(LOG,
(errmsg("temp file: path \"%s\" size %lu", (errmsg("temp file: path \"%s\" size %lu",
vfdP->fileName, (unsigned long)filestats.st_size))); vfdP->fileName,
(unsigned long) filestats.st_size)));
} }
else else
elog(LOG, "Could not stat \"%s\": %m", vfdP->fileName); elog(LOG, "could not stat file \"%s\": %m", vfdP->fileName);
} }
if (unlink(vfdP->fileName)) if (unlink(vfdP->fileName))
elog(LOG, "failed to unlink \"%s\": %m", elog(LOG, "could not unlink file \"%s\": %m", vfdP->fileName);
vfdP->fileName);
} }
/* /*
...@@ -1022,23 +1020,6 @@ FileClose(File file) ...@@ -1022,23 +1020,6 @@ FileClose(File file)
FreeVfd(file); FreeVfd(file);
} }
/*
* close a file and forcibly delete the underlying Unix file
*/
void
FileUnlink(File file)
{
Assert(FileIsValid(file));
DO_DB(elog(LOG, "FileUnlink: %d (%s)",
file, VfdCache[file].fileName));
/* force FileClose to delete it */
VfdCache[file].fdstate |= FD_TEMPORARY;
FileClose(file);
}
int int
FileRead(File file, char *buffer, int amount) FileRead(File file, char *buffer, int amount)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.59 2007/06/07 19:19:57 tgl Exp $ * $PostgreSQL: pgsql/src/include/storage/fd.h,v 1.60 2007/07/26 15:15:18 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -62,7 +62,6 @@ extern int max_files_per_process; ...@@ -62,7 +62,6 @@ extern int max_files_per_process;
extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode); extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode);
extern File OpenTemporaryFile(bool interXact); extern File OpenTemporaryFile(bool interXact);
extern void FileClose(File file); extern void FileClose(File file);
extern void FileUnlink(File file);
extern int FileRead(File file, char *buffer, int amount); extern int FileRead(File file, char *buffer, int amount);
extern int FileWrite(File file, char *buffer, int amount); extern int FileWrite(File file, char *buffer, int amount);
extern int FileSync(File file); extern int FileSync(File file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment