mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Reverse out XLogDir/-X write-ahead log handling, per discussion.
Original patch from Thomas.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.101 2002/08/06 02:36:33 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.102 2002/08/17 15:12:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -398,8 +398,7 @@ static ControlFileData *ControlFile = NULL;
|
||||
|
||||
|
||||
/* File path names */
|
||||
char *XLogDir = NULL;
|
||||
|
||||
static char XLogDir[MAXPGPATH];
|
||||
static char ControlFilePath[MAXPGPATH];
|
||||
|
||||
/*
|
||||
@@ -2075,29 +2074,11 @@ ValidXLOGHeader(XLogPageHeader hdr, int emode, bool checkSUI)
|
||||
* I/O and compatibility-check functions, but there seems no need currently.
|
||||
*/
|
||||
|
||||
void
|
||||
SetXLogDir(char *path)
|
||||
{
|
||||
char *xsubdir = "/pg_xlog";
|
||||
|
||||
if (path != NULL)
|
||||
{
|
||||
XLogDir = malloc(strlen(path)+1);
|
||||
strcpy(XLogDir, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
XLogDir = malloc(strlen(DataDir)+strlen(xsubdir)+1);
|
||||
snprintf(XLogDir, MAXPGPATH, "%s%s", DataDir, xsubdir);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
XLOGPathInit(void)
|
||||
{
|
||||
/* Init XLOG file paths */
|
||||
if (XLogDir == NULL)
|
||||
SetXLogDir(NULL);
|
||||
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
|
||||
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.137 2002/08/10 20:29:17 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.138 2002/08/17 15:12:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -222,7 +222,6 @@ BootstrapMain(int argc, char *argv[])
|
||||
int flag;
|
||||
int xlogop = BS_XLOG_NOP;
|
||||
char *potential_DataDir = NULL;
|
||||
char *potential_XLogDir = NULL;
|
||||
|
||||
/*
|
||||
* initialize globals
|
||||
@@ -249,22 +248,17 @@ BootstrapMain(int argc, char *argv[])
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
InitializeGUCOptions();
|
||||
/* Null if no PGDATA variable */
|
||||
potential_DataDir = getenv("PGDATA");
|
||||
/* Null if no PGXLOG variable */
|
||||
potential_XLogDir = getenv("PGXLOG");
|
||||
potential_DataDir = getenv("PGDATA"); /* Null if no PGDATA
|
||||
* variable */
|
||||
}
|
||||
|
||||
while ((flag = getopt(argc, argv, "B:d:D:X:Fo:px:")) != -1)
|
||||
while ((flag = getopt(argc, argv, "B:d:D:Fo:px:")) != -1)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
case 'D':
|
||||
potential_DataDir = optarg;
|
||||
break;
|
||||
case 'X':
|
||||
potential_XLogDir = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
/* Turn on debugging for the bootstrap process. */
|
||||
@@ -319,7 +313,6 @@ BootstrapMain(int argc, char *argv[])
|
||||
proc_exit(1);
|
||||
}
|
||||
SetDataDir(potential_DataDir);
|
||||
SetXLogDir(potential_XLogDir);
|
||||
}
|
||||
|
||||
/* Validate we have been given a reasonable-looking DataDir */
|
||||
|
@@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.283 2002/08/10 20:29:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.284 2002/08/17 15:12:06 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -346,7 +346,6 @@ PostmasterMain(int argc, char *argv[])
|
||||
int status;
|
||||
char original_extraoptions[MAXPGPATH];
|
||||
char *potential_DataDir = NULL;
|
||||
char *potential_XLogDir = NULL;
|
||||
|
||||
*original_extraoptions = '\0';
|
||||
|
||||
@@ -404,11 +403,10 @@ PostmasterMain(int argc, char *argv[])
|
||||
InitializeGUCOptions();
|
||||
|
||||
potential_DataDir = getenv("PGDATA"); /* default value */
|
||||
potential_XLogDir = getenv("PGXLOG"); /* default value */
|
||||
|
||||
opterr = 1;
|
||||
|
||||
while ((opt = getopt(argc, argv, "A:a:B:b:c:D:X:d:Fh:ik:lm:MN:no:p:Ss-:")) != -1)
|
||||
while ((opt = getopt(argc, argv, "A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
@@ -431,9 +429,6 @@ PostmasterMain(int argc, char *argv[])
|
||||
case 'D':
|
||||
potential_DataDir = optarg;
|
||||
break;
|
||||
case 'X':
|
||||
potential_XLogDir = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
/* Turn on debugging for the postmaster. */
|
||||
@@ -568,7 +563,6 @@ PostmasterMain(int argc, char *argv[])
|
||||
|
||||
checkDataDir(potential_DataDir); /* issues error messages */
|
||||
SetDataDir(potential_DataDir);
|
||||
SetXLogDir(potential_XLogDir);
|
||||
|
||||
ProcessConfigFile(PGC_POSTMASTER);
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.282 2002/08/15 16:36:05 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.283 2002/08/17 15:12:07 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@@ -1120,7 +1120,6 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
StringInfo parser_input;
|
||||
|
||||
char *potential_DataDir = NULL;
|
||||
char *potential_XLogDir = NULL;
|
||||
|
||||
/*
|
||||
* Catch standard options before doing much else. This even works on
|
||||
@@ -1164,7 +1163,6 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
{
|
||||
InitializeGUCOptions();
|
||||
potential_DataDir = getenv("PGDATA");
|
||||
potential_XLogDir = getenv("PGXLOG");
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
@@ -1189,7 +1187,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
ctx = PGC_POSTMASTER;
|
||||
gucsource = PGC_S_ARGV; /* initial switches came from command line */
|
||||
|
||||
while ((flag = getopt(argc, argv, "A:B:c:CD:X:d:Eef:FiNOPo:p:S:st:v:W:x:-:")) != -1)
|
||||
while ((flag = getopt(argc, argv, "A:B:c:CD:d:Eef:FiNOPo:p:S:st:v:W:x:-:")) != -1)
|
||||
switch (flag)
|
||||
{
|
||||
case 'A':
|
||||
@@ -1221,11 +1219,6 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
potential_DataDir = optarg;
|
||||
break;
|
||||
|
||||
case 'X': /* PGXLOG directory */
|
||||
if (secure)
|
||||
potential_XLogDir = optarg;
|
||||
break;
|
||||
|
||||
case 'd': /* debug level */
|
||||
{
|
||||
/* Set server debugging level. */
|
||||
@@ -1517,7 +1510,6 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
proc_exit(1);
|
||||
}
|
||||
SetDataDir(potential_DataDir);
|
||||
SetXLogDir(potential_XLogDir);
|
||||
}
|
||||
Assert(DataDir);
|
||||
|
||||
@@ -1674,7 +1666,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
puts("\nPOSTGRES backend interactive interface ");
|
||||
puts("$Revision: 1.282 $ $Date: 2002/08/15 16:36:05 $\n");
|
||||
puts("$Revision: 1.283 $ $Date: 2002/08/17 15:12:07 $\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user