mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +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:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.44 2005/06/19 21:34:02 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.45 2005/07/04 04:51:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -145,10 +145,10 @@ pg_tablespace_databases(PG_FUNCTION_ARGS)
|
||||
fctx = palloc(sizeof(ts_db_fctx));
|
||||
|
||||
/*
|
||||
* size = path length + tablespace dirname length + 2 dir sep
|
||||
* chars + oid + terminator
|
||||
* size = tablespace dirname length + dir sep
|
||||
* char + oid + terminator
|
||||
*/
|
||||
fctx->location = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
|
||||
fctx->location = (char *) palloc(10 + 10 + 1);
|
||||
if (tablespaceOid == GLOBALTABLESPACE_OID)
|
||||
{
|
||||
fctx->dirdesc = NULL;
|
||||
@ -158,10 +158,9 @@ pg_tablespace_databases(PG_FUNCTION_ARGS)
|
||||
else
|
||||
{
|
||||
if (tablespaceOid == DEFAULTTABLESPACE_OID)
|
||||
sprintf(fctx->location, "%s/base", DataDir);
|
||||
sprintf(fctx->location, "base");
|
||||
else
|
||||
sprintf(fctx->location, "%s/pg_tblspc/%u", DataDir,
|
||||
tablespaceOid);
|
||||
sprintf(fctx->location, "pg_tblspc/%u", tablespaceOid);
|
||||
|
||||
fctx->dirdesc = AllocateDir(fctx->location);
|
||||
|
||||
|
Reference in New Issue
Block a user