1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Implement WAL log location control using "-X" or PGXLOG.

This commit is contained in:
Thomas G. Lockhart
2002-08-04 06:26:38 +00:00
parent a19d9d3c4c
commit af704cdfb4
6 changed files with 135 additions and 55 deletions

View File

@@ -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.135 2002/08/02 22:36:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.136 2002/08/04 06:26:38 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -223,6 +223,7 @@ BootstrapMain(int argc, char *argv[])
int flag;
int xlogop = BS_XLOG_NOP;
char *potential_DataDir = NULL;
char *potential_XLogDir = NULL;
/*
* initialize globals
@@ -250,17 +251,22 @@ BootstrapMain(int argc, char *argv[])
if (!IsUnderPostmaster)
{
InitializeGUCOptions();
potential_DataDir = getenv("PGDATA"); /* Null if no PGDATA
* variable */
/* Null if no PGDATA variable */
potential_DataDir = getenv("PGDATA");
/* Null if no PGXLOG variable */
potential_XLogDir = getenv("PGXLOG");
}
while ((flag = getopt(argc, argv, "B:d:D:Fo:px:")) != -1)
while ((flag = getopt(argc, argv, "B:d:D:X: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. */
@@ -315,6 +321,7 @@ BootstrapMain(int argc, char *argv[])
proc_exit(1);
}
SetDataDir(potential_DataDir);
SetXLogDir(potential_XLogDir);
}
/* Validate we have been given a reasonable-looking DataDir */

View File

@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.281 2002/07/13 01:02:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.282 2002/08/04 06:26:38 thomas Exp $
*
* NOTES
*
@@ -347,6 +347,7 @@ PostmasterMain(int argc, char *argv[])
int status;
char original_extraoptions[MAXPGPATH];
char *potential_DataDir = NULL;
char *potential_XLogDir = NULL;
*original_extraoptions = '\0';
@@ -405,10 +406,11 @@ 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:d:Fh:ik:lm:MN:no:p:Ss-:")) != -1)
while ((opt = getopt(argc, argv, "A:a:B:b:c:D:X:d:Fh:ik:lm:MN:no:p:Ss-:")) != -1)
{
switch (opt)
{
@@ -431,6 +433,9 @@ 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. */
@@ -565,6 +570,7 @@ PostmasterMain(int argc, char *argv[])
checkDataDir(potential_DataDir); /* issues error messages */
SetDataDir(potential_DataDir);
SetXLogDir(potential_XLogDir);
ProcessConfigFile(PGC_POSTMASTER);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.277 2002/08/04 04:31:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.278 2002/08/04 06:26:33 thomas Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -1146,6 +1146,7 @@ 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
@@ -1190,6 +1191,7 @@ PostgresMain(int argc, char *argv[], const char *username)
{
InitializeGUCOptions();
potential_DataDir = getenv("PGDATA");
potential_XLogDir = getenv("PGXLOG");
}
/* ----------------
@@ -1214,7 +1216,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:d:Eef:FiNOPo:p:S:st:v:W:x:-:")) != -1)
while ((flag = getopt(argc, argv, "A:B:c:CD:X:d:Eef:FiNOPo:p:S:st:v:W:x:-:")) != -1)
switch (flag)
{
case 'A':
@@ -1246,6 +1248,11 @@ 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. */
@@ -1537,8 +1544,10 @@ PostgresMain(int argc, char *argv[], const char *username)
proc_exit(1);
}
SetDataDir(potential_DataDir);
SetXLogDir(potential_XLogDir);
}
Assert(DataDir);
Assert(strlen(XLogDir) > 0);
/*
* Set up signal handlers and masks.
@@ -1693,7 +1702,7 @@ PostgresMain(int argc, char *argv[], const char *username)
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.277 $ $Date: 2002/08/04 04:31:44 $\n");
puts("$Revision: 1.278 $ $Date: 2002/08/04 06:26:33 $\n");
}
/*