Skip to content

Commit c755f60

Browse files
author
Thomas G. Lockhart
committed
Implement WAL log location control using "-X" or PGXLOG.
1 parent eb121ba commit c755f60

File tree

1 file changed

+20
-3
lines changed
  • src/backend/access/transam

1 file changed

+20
-3
lines changed

src/backend/access/transam/xlog.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.98 2002/06/20 20:29:25 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.99 2002/08/04 06:53:10 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -389,7 +389,7 @@ static ControlFileData *ControlFile = NULL;
389389

390390

391391
/* File path names */
392-
static char XLogDir[MAXPGPATH];
392+
static char XLogDir[MAXPGPATH] = "";
393393
static char ControlFilePath[MAXPGPATH];
394394

395395
/*
@@ -2065,11 +2065,28 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
20652065
* I/O and compatibility-check functions, but there seems no need currently.
20662066
*/
20672067

2068+
void
2069+
SetXLogDir(char *path)
2070+
{
2071+
if (path != NULL)
2072+
{
2073+
if (strlen(path) >= MAXPGPATH)
2074+
elog(FATAL, "XLOG path '%s' is too long"
2075+
"; maximum length is %d characters", path, MAXPGPATH-1);
2076+
strcpy(XLogDir, path);
2077+
}
2078+
else
2079+
{
2080+
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
2081+
}
2082+
}
2083+
20682084
void
20692085
XLOGPathInit(void)
20702086
{
20712087
/* Init XLOG file paths */
2072-
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
2088+
if (strlen(XLogDir) <= 0)
2089+
SetXLogDir(NULL);
20732090
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
20742091
}
20752092

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy