1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Arrange for the postmaster (and standalone backends, initdb, etc) to

chdir into PGDATA and subsequently use relative paths instead of absolute
paths to access all files under PGDATA.  This seems to give a small
performance improvement, and it should make the system more robust
against naive DBAs doing things like moving a database directory that
has a live postmaster in it.  Per recent discussion.
This commit is contained in:
Tom Lane
2005-07-04 04:51:52 +00:00
parent 7504f0bae8
commit eb5949d190
27 changed files with 364 additions and 474 deletions

View File

@ -18,7 +18,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.15 2005/04/19 03:13:59 momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.16 2005/07/04 04:51:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -422,17 +422,9 @@ SysLogger_Start(void)
#endif
/*
* create log directory if not present; ignore errors
* Create log directory if not present; ignore errors
*/
if (is_absolute_path(Log_directory))
mkdir(Log_directory, 0700);
else
{
filename = palloc(MAXPGPATH);
snprintf(filename, MAXPGPATH, "%s/%s", DataDir, Log_directory);
mkdir(filename, 0700);
pfree(filename);
}
mkdir(Log_directory, 0700);
/*
* The initial logfile is created right in the postmaster, to verify
@ -823,10 +815,7 @@ logfile_getname(pg_time_t timestamp)
filename = palloc(MAXPGPATH);
if (is_absolute_path(Log_directory))
snprintf(filename, MAXPGPATH, "%s/", Log_directory);
else
snprintf(filename, MAXPGPATH, "%s/%s/", DataDir, Log_directory);
snprintf(filename, MAXPGPATH, "%s/", Log_directory);
len = strlen(filename);