summaryrefslogtreecommitdiff
path: root/src/backend/utils/init/globals.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/utils/init/globals.c
parent7504f0bae853b0b9fec03c8e361c8b1a4b1c3209 (diff)
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/utils/init/globals.c')
-rw-r--r--src/backend/utils/init/globals.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 1c9725d6298..a4fb354a4c9 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/init/globals.c,v 1.95 2004/12/31 22:01:40 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/globals.c,v 1.96 2005/07/04 04:51:50 tgl Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
@@ -36,13 +36,14 @@ int MyProcPid;
struct Port *MyProcPort;
long MyCancelKey;
+/*
+ * DataDir is the absolute path to the top level of the PGDATA directory tree.
+ * Except during early startup, this is also the server's working directory;
+ * most code therefore can simply use relative paths and not reference DataDir
+ * explicitly.
+ */
char *DataDir = NULL;
- /*
- * The PGDATA directory user says to use, or defaults to via environment
- * variable. NULL if no option given and no environment variable set
- */
-
char OutputFileName[MAXPGPATH]; /* debugging output file */
char my_exec_path[MAXPGPATH]; /* full path to my executable */
@@ -56,11 +57,16 @@ char postgres_exec_path[MAXPGPATH]; /* full path to backend */
BackendId MyBackendId = InvalidBackendId;
-char *DatabasePath = NULL;
Oid MyDatabaseId = InvalidOid;
Oid MyDatabaseTableSpace = InvalidOid;
+/*
+ * DatabasePath is the path (relative to DataDir) of my database's
+ * primary directory, ie, its directory in the default tablespace.
+ */
+char *DatabasePath = NULL;
+
pid_t PostmasterPid = 0;
/*