aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-07-04 04:51:52 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-07-04 04:51:52 +0000
commiteb5949d190e80360386113fde0f05854f0c9824d (patch)
treef5683b4ff77c0b311ae975817b88c5ccc65ce5a9 /src/backend/commands/tablespace.c
parent7504f0bae853b0b9fec03c8e361c8b1a4b1c3209 (diff)
downloadpostgresql-eb5949d190e80360386113fde0f05854f0c9824d.tar.gz
postgresql-eb5949d190e80360386113fde0f05854f0c9824d.zip
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.
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 15a263b8efd..b925825062f 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.23 2005/06/28 05:08:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.24 2005/07/04 04:51:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -338,8 +338,8 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
/*
* All seems well, create the symlink
*/
- linkloc = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
- sprintf(linkloc, "%s/pg_tblspc/%u", DataDir, tablespaceoid);
+ linkloc = (char *) palloc(10 + 10 + 1);
+ sprintf(linkloc, "pg_tblspc/%u", tablespaceoid);
if (symlink(location, linkloc) < 0)
ereport(ERROR,
@@ -491,8 +491,8 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
char *subfile;
struct stat st;
- location = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
- sprintf(location, "%s/pg_tblspc/%u", DataDir, tablespaceoid);
+ location = (char *) palloc(10 + 10 + 1);
+ sprintf(location, "pg_tblspc/%u", tablespaceoid);
/*
* Check if the tablespace still contains any files. We try to rmdir
@@ -989,8 +989,8 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
set_short_version(location);
/* Create the symlink if not already present */
- linkloc = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
- sprintf(linkloc, "%s/pg_tblspc/%u", DataDir, xlrec->ts_id);
+ linkloc = (char *) palloc(10 + 10 + 1);
+ sprintf(linkloc, "pg_tblspc/%u", xlrec->ts_id);
if (symlink(location, linkloc) < 0)
{