diff options
| author | Tom Lane | 2005-07-04 04:51:52 +0000 |
|---|---|---|
| committer | Tom Lane | 2005-07-04 04:51:52 +0000 |
| commit | eb5949d190e80360386113fde0f05854f0c9824d (patch) | |
| tree | f5683b4ff77c0b311ae975817b88c5ccc65ce5a9 /src/include | |
| parent | 7504f0bae853b0b9fec03c8e361c8b1a4b1c3209 (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/include')
| -rw-r--r-- | src/include/access/slru.h | 4 | ||||
| -rw-r--r-- | src/include/access/xlog.h | 3 | ||||
| -rw-r--r-- | src/include/access/xlog_internal.h | 18 | ||||
| -rw-r--r-- | src/include/miscadmin.h | 5 |
4 files changed, 17 insertions, 13 deletions
diff --git a/src/include/access/slru.h b/src/include/access/slru.h index 0db7019a16..602e2e3c1f 100644 --- a/src/include/access/slru.h +++ b/src/include/access/slru.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/slru.h,v 1.11 2004/12/31 22:03:21 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/access/slru.h,v 1.12 2005/07/04 04:51:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -87,7 +87,7 @@ typedef struct SlruCtlData * Dir is set during SimpleLruInit and does not change thereafter. * Since it's always the same, it doesn't need to be in shared memory. */ - char Dir[MAXPGPATH]; + char Dir[64]; } SlruCtlData; typedef SlruCtlData *SlruCtl; diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index ead4619b02..8bbc6846de 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.65 2005/06/08 15:50:28 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.66 2005/07/04 04:51:52 tgl Exp $ */ #ifndef XLOG_H #define XLOG_H @@ -158,7 +158,6 @@ extern void xlog_desc(char *buf, uint8 xl_info, char *rec); extern void UpdateControlFile(void); extern int XLOGShmemSize(void); extern void XLOGShmemInit(void); -extern void XLOGPathInit(void); extern void BootStrapXLOG(void); extern void StartupXLOG(void); extern void ShutdownXLOG(int code, Datum arg); diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 76e20b0355..4c65bdaec7 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.8 2005/06/06 17:01:25 tgl Exp $ + * $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.9 2005/07/04 04:51:52 tgl Exp $ */ #ifndef XLOG_INTERNAL_H #define XLOG_INTERNAL_H @@ -186,6 +186,12 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; (BLCKSZ - (xrecoff) % BLCKSZ) >= SizeOfXLogRecord) /* + * The XLog directory and control file (relative to $PGDATA) + */ +#define XLOGDIR "pg_xlog" +#define XLOG_CONTROL_FILE "global/pg_control" + +/* * These macros encapsulate knowledge about the exact layout of XLog file * names, timeline history file names, and archive-status file names. */ @@ -195,24 +201,22 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader; snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli, log, seg) #define XLogFilePath(path, tli, log, seg) \ - snprintf(path, MAXPGPATH, "%s/%08X%08X%08X", XLogDir, tli, log, seg) + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X", tli, log, seg) #define TLHistoryFileName(fname, tli) \ snprintf(fname, MAXFNAMELEN, "%08X.history", tli) #define TLHistoryFilePath(path, tli) \ - snprintf(path, MAXPGPATH, "%s/%08X.history", XLogDir, tli) + snprintf(path, MAXPGPATH, XLOGDIR "/%08X.history", tli) #define StatusFilePath(path, xlog, suffix) \ - snprintf(path, MAXPGPATH, "%s/archive_status/%s%s", XLogDir, xlog, suffix) + snprintf(path, MAXPGPATH, XLOGDIR "/archive_status/%s%s", xlog, suffix) #define BackupHistoryFileName(fname, tli, log, seg, offset) \ snprintf(fname, MAXFNAMELEN, "%08X%08X%08X.%08X.backup", tli, log, seg, offset) #define BackupHistoryFilePath(path, tli, log, seg, offset) \ - snprintf(path, MAXPGPATH, "%s/%08X%08X%08X.%08X.backup", XLogDir, tli, log, seg, offset) - -extern char XLogDir[MAXPGPATH]; + snprintf(path, MAXPGPATH, XLOGDIR "/%08X%08X%08X.%08X.backup", tli, log, seg, offset) /* diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 8f6930cd13..1ee085e51a 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -13,7 +13,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.176 2005/06/28 05:09:04 tgl Exp $ + * $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.177 2005/07/04 04:51:52 tgl Exp $ * * NOTES * some of the information in this file should be moved to other files. @@ -238,6 +238,7 @@ extern void InitializeSessionUserIdStandalone(void); extern void SetSessionAuthorization(Oid roleid, bool is_superuser); extern void SetDataDir(const char *dir); +extern void ChangeToDataDir(void); extern char *make_absolute_path(const char *path); /* in utils/misc/superuser.c */ @@ -309,7 +310,7 @@ extern void SetReindexProcessing(Oid heapOid, Oid indexOid); extern void ResetReindexProcessing(void); extern bool ReindexIsProcessingHeap(Oid heapOid); extern bool ReindexIsProcessingIndex(Oid indexOid); -extern void CreateDataDirLockFile(const char *datadir, bool amPostmaster); +extern void CreateDataDirLockFile(bool amPostmaster); extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster); extern void TouchSocketLockFile(void); extern void RecordSharedMemoryInLockFile(unsigned long id1, |
