Index: src/backend/access/transam/xlog.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/access/transam/xlog.c,v retrieving revision 1.101 diff -c -r1.101 xlog.c *** src/backend/access/transam/xlog.c 6 Aug 2002 02:36:33 -0000 1.101 --- src/backend/access/transam/xlog.c 17 Aug 2002 15:07:06 -0000 *************** *** 398,405 **** /* File path names */ ! char *XLogDir = NULL; ! static char ControlFilePath[MAXPGPATH]; /* --- 398,404 ---- /* File path names */ ! static char XLogDir[MAXPGPATH]; static char ControlFilePath[MAXPGPATH]; /* *************** *** 2076,2103 **** */ 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(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir); } --- 2075,2084 ---- */ void XLOGPathInit(void) { /* Init XLOG file paths */ ! snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir); snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir); } Index: src/backend/bootstrap/bootstrap.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/bootstrap/bootstrap.c,v retrieving revision 1.137 diff -c -r1.137 bootstrap.c *** src/backend/bootstrap/bootstrap.c 10 Aug 2002 20:29:17 -0000 1.137 --- src/backend/bootstrap/bootstrap.c 17 Aug 2002 15:07:07 -0000 *************** *** 222,228 **** int flag; int xlogop = BS_XLOG_NOP; char *potential_DataDir = NULL; - char *potential_XLogDir = NULL; /* * initialize globals --- 222,227 ---- *************** *** 249,270 **** if (!IsUnderPostmaster) { InitializeGUCOptions(); ! /* 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: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. */ --- 248,264 ---- if (!IsUnderPostmaster) { InitializeGUCOptions(); ! potential_DataDir = getenv("PGDATA"); /* Null if no PGDATA ! * variable */ } ! while ((flag = getopt(argc, argv, "B:d:D:Fo:px:")) != -1) { switch (flag) { case 'D': potential_DataDir = optarg; break; case 'd': { /* Turn on debugging for the bootstrap process. */ *************** *** 319,325 **** proc_exit(1); } SetDataDir(potential_DataDir); - SetXLogDir(potential_XLogDir); } /* Validate we have been given a reasonable-looking DataDir */ --- 313,318 ---- Index: src/backend/postmaster/postmaster.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v retrieving revision 1.283 diff -c -r1.283 postmaster.c *** src/backend/postmaster/postmaster.c 10 Aug 2002 20:29:18 -0000 1.283 --- src/backend/postmaster/postmaster.c 17 Aug 2002 15:07:09 -0000 *************** *** 346,352 **** int status; char original_extraoptions[MAXPGPATH]; char *potential_DataDir = NULL; - char *potential_XLogDir = NULL; *original_extraoptions = '\0'; --- 346,351 ---- *************** *** 404,414 **** 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) { switch (opt) { --- 403,412 ---- InitializeGUCOptions(); potential_DataDir = getenv("PGDATA"); /* default value */ opterr = 1; ! while ((opt = getopt(argc, argv, "A:a:B:b:c:D:d:Fh:ik:lm:MN:no:p:Ss-:")) != -1) { switch (opt) { *************** *** 431,439 **** case 'D': potential_DataDir = optarg; break; - case 'X': - potential_XLogDir = optarg; - break; case 'd': { /* Turn on debugging for the postmaster. */ --- 429,434 ---- *************** *** 568,574 **** checkDataDir(potential_DataDir); /* issues error messages */ SetDataDir(potential_DataDir); - SetXLogDir(potential_XLogDir); ProcessConfigFile(PGC_POSTMASTER); --- 563,568 ---- Index: src/backend/tcop/postgres.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/tcop/postgres.c,v retrieving revision 1.282 diff -c -r1.282 postgres.c *** src/backend/tcop/postgres.c 15 Aug 2002 16:36:05 -0000 1.282 --- src/backend/tcop/postgres.c 17 Aug 2002 15:07:14 -0000 *************** *** 1120,1126 **** StringInfo parser_input; char *potential_DataDir = NULL; - char *potential_XLogDir = NULL; /* * Catch standard options before doing much else. This even works on --- 1120,1125 ---- *************** *** 1164,1170 **** { InitializeGUCOptions(); potential_DataDir = getenv("PGDATA"); - potential_XLogDir = getenv("PGXLOG"); } /* ---------------- --- 1163,1168 ---- *************** *** 1189,1195 **** 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) switch (flag) { case 'A': --- 1187,1193 ---- 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) switch (flag) { case 'A': *************** *** 1221,1231 **** potential_DataDir = optarg; break; - case 'X': /* PGXLOG directory */ - if (secure) - potential_XLogDir = optarg; - break; - case 'd': /* debug level */ { /* Set server debugging level. */ --- 1219,1224 ---- *************** *** 1517,1523 **** proc_exit(1); } SetDataDir(potential_DataDir); - SetXLogDir(potential_XLogDir); } Assert(DataDir); --- 1510,1515 ---- Index: src/bin/initdb/initdb.sh =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/initdb/initdb.sh,v retrieving revision 1.167 diff -c -r1.167 initdb.sh *** src/bin/initdb/initdb.sh 17 Aug 2002 13:04:15 -0000 1.167 --- src/bin/initdb/initdb.sh 17 Aug 2002 15:07:15 -0000 *************** *** 252,270 **** -D*) PGDATA=`echo $1 | sed 's/^-D//'` ;; - # Directory to hold WAL log files. - --pgxlog|-X) - PGXLOG="$2" - defined_pgxlog=yes - shift;; - --pgxlog=*) - PGXLOG=`echo $1 | sed 's/^--pgxlog=//'` - defined_pgxlog=yes - ;; - -X*) - PGXLOG=`echo $1 | sed 's/^-X//'` - defined_pgxlog=yes - ;; # The directory where the .bki input files are stored. Normally # they are in PREFIX/share and this option should be unnecessary. -L) --- 252,257 ---- *************** *** 354,360 **** echo echo "Options:" echo " [-D, --pgdata] DATADIR Location for this database cluster" - echo " [-X, --pgxlog] XLOGDIR Location for the cluster transaction logs" echo " -W, --pwprompt Prompt for a password for the new superuser" if [ -n "$MULTIBYTE" ] ; then echo " -E, --encoding ENCODING Set default encoding for new databases" --- 341,346 ---- *************** *** 415,425 **** exit 1 fi - if [ -z "$PGXLOG" ] - then - PGXLOG="$PGDATA"/pg_xlog - fi - #------------------------------------------------------------------------- # Find the input files --- 401,406 ---- *************** *** 437,443 **** ( echo echo "initdb variables:" ! for var in PGDATA PGXLOG datadir PGPATH MULTIBYTE MULTIBYTEID \ POSTGRES_SUPERUSERNAME POSTGRES_BKI \ POSTGRES_DESCR POSTGRESQL_CONF_SAMPLE \ PG_HBA_SAMPLE PG_IDENT_SAMPLE ; do --- 418,424 ---- ( echo echo "initdb variables:" ! for var in PGDATA datadir PGPATH MULTIBYTE MULTIBYTEID \ POSTGRES_SUPERUSERNAME POSTGRES_BKI \ POSTGRES_DESCR POSTGRESQL_CONF_SAMPLE \ PG_HBA_SAMPLE PG_IDENT_SAMPLE ; do *************** *** 522,582 **** echo "$CMDNAME: The directory $PGDATA exists but is not empty." echo "If you want to create a new database system, either remove or empty" echo "the directory $PGDATA or run initdb with" ! echo "an argument for -D other than $PGDATA." ! ) 1>&2 ! exit 1 ! fi ! ! # find out if transaction log directory is empty ! pgxlog_contents=`ls -A "$PGXLOG" 2>/dev/null` ! if [ x"$pgxlog_contents" != x ] ! then ! ( ! echo "$CMDNAME: The directory $PGXLOG exists but is not empty." ! echo "If you want to create a new transaction log, either remove or empty" ! echo "the directory $PGXLOG or run initdb with" ! echo "an argument for -X other than $PGXLOG." ) 1>&2 exit 1 - fi - - if [ ! -d "$PGDATA" ]; then - $ECHO_N "creating directory $PGDATA... "$ECHO_C - mkdir -p "$PGDATA" >/dev/null 2>&1 || mkdir "$PGDATA" || exit_nicely - made_new_pgdata=yes else ! $ECHO_N "Fixing permissions on existing directory $PGDATA... "$ECHO_C ! chmod go-rwx "$PGDATA" || exit_nicely ! fi ! echo "ok" ! ! if [ ! -d "$PGXLOG" ]; then ! $ECHO_N "creating directory $PGXLOG... "$ECHO_C ! mkdir -p "$PGXLOG" >/dev/null 2>&1 || mkdir "$PGXLOG" || exit_nicely ! made_new_pgxlog=yes ! else ! $ECHO_N "Fixing permissions on existing directory $PGXLOG... "$ECHO_C ! chmod go-rwx "$PGXLOG" || exit_nicely ! fi ! echo "ok" ! if [ ! -d "$PGDATA"/base ] ! then ! $ECHO_N "creating directory $PGDATA/base... "$ECHO_C ! mkdir "$PGDATA"/base || exit_nicely ! echo "ok" ! fi ! if [ ! -d "$PGDATA"/global ] ! then ! $ECHO_N "creating directory $PGDATA/global... "$ECHO_C ! mkdir "$PGDATA"/global || exit_nicely ! echo "ok" ! fi ! if [ ! -d "$PGDATA"/pg_clog ] ! then ! $ECHO_N "creating directory $PGDATA/pg_clog... "$ECHO_C ! mkdir "$PGDATA"/pg_clog || exit_nicely ! echo "ok" fi --- 503,546 ---- echo "$CMDNAME: The directory $PGDATA exists but is not empty." echo "If you want to create a new database system, either remove or empty" echo "the directory $PGDATA or run initdb with" ! echo "an argument other than $PGDATA." ) 1>&2 exit 1 else ! if [ ! -d "$PGDATA" ]; then ! $ECHO_N "creating directory $PGDATA... "$ECHO_C ! mkdir -p "$PGDATA" >/dev/null 2>&1 || mkdir "$PGDATA" || exit_nicely ! made_new_pgdata=yes ! else ! $ECHO_N "Fixing permissions on existing directory $PGDATA... "$ECHO_C ! chmod go-rwx "$PGDATA" || exit_nicely ! fi ! echo "ok" ! if [ ! -d "$PGDATA"/base ] ! then ! $ECHO_N "creating directory $PGDATA/base... "$ECHO_C ! mkdir "$PGDATA"/base || exit_nicely ! echo "ok" ! fi ! if [ ! -d "$PGDATA"/global ] ! then ! $ECHO_N "creating directory $PGDATA/global... "$ECHO_C ! mkdir "$PGDATA"/global || exit_nicely ! echo "ok" ! fi ! if [ ! -d "$PGDATA"/pg_xlog ] ! then ! $ECHO_N "creating directory $PGDATA/pg_xlog... "$ECHO_C ! mkdir "$PGDATA"/pg_xlog || exit_nicely ! echo "ok" ! fi ! if [ ! -d "$PGDATA"/pg_clog ] ! then ! $ECHO_N "creating directory $PGDATA/pg_clog... "$ECHO_C ! mkdir "$PGDATA"/pg_clog || exit_nicely ! echo "ok" ! fi fi *************** *** 585,591 **** # RUN BKI SCRIPT IN BOOTSTRAP MODE TO CREATE TEMPLATE1 # common backend options ! PGSQL_OPT="-F -D$PGDATA -X$PGXLOG" if [ "$debug" = yes ] then --- 549,555 ---- # RUN BKI SCRIPT IN BOOTSTRAP MODE TO CREATE TEMPLATE1 # common backend options ! PGSQL_OPT="-F -D$PGDATA" if [ "$debug" = yes ] then *************** *** 1130,1153 **** # # FINISHED - postmaster_startup="$PGPATH/postmaster -D $PGDATA" - if [ x"$defined_pgxlog" != x ]; then - postmaster_startup="$postmaster_startup -X $PGXLOG" - fi - pg_ctl_startup="$PGPATH/pg_ctl -D $PGDATA" - if [ x"$defined_pgxlog" != x ]; then - pg_ctl_startup="$pg_ctl_startup -X $PGXLOG" - fi - pg_ctl_startup="$pg_ctl_startup -l logfile start" - echo echo "Success. You can now start the database server using:" echo "" ! echo " $postmaster_startup" echo "or" # (Advertise -l option here, otherwise we have a background # process writing to the terminal.) ! echo " $pg_ctl_startup" echo exit 0 --- 1094,1107 ---- # # FINISHED echo echo "Success. You can now start the database server using:" echo "" ! echo " $PGPATH/postmaster -D $PGDATA" echo "or" # (Advertise -l option here, otherwise we have a background # process writing to the terminal.) ! echo " $PGPATH/pg_ctl -D $PGDATA -l logfile start" echo exit 0 Index: src/bin/pg_ctl/pg_ctl.sh =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/pg_ctl/pg_ctl.sh,v retrieving revision 1.28 diff -c -r1.28 pg_ctl.sh *** src/bin/pg_ctl/pg_ctl.sh 4 Aug 2002 06:26:38 -0000 1.28 --- src/bin/pg_ctl/pg_ctl.sh 17 Aug 2002 15:07:16 -0000 *************** *** 19,41 **** or report the status of a PostgreSQL server. Usage: ! $CMDNAME start [-w] [-D DATADIR] [-s] [-X PGXLOG] [-l FILENAME] [-o \"OPTIONS\"] $CMDNAME stop [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] ! $CMDNAME restart [-w] [-D DATADIR] [-s] [-X PGXLOG] [-m SHUTDOWN-MODE] [-o \"OPTIONS\"] $CMDNAME reload [-D DATADIR] [-s] $CMDNAME status [-D DATADIR] Common options: -D DATADIR Location of the database storage area - -X XLOGDIR Location of the WAL log file storage area -s Only print errors, no informational messages -w Wait until operation completes -W Do not wait until operation completes (The default is to wait for shutdown, but not for start or restart.) If the -D option is omitted, the environment variable PGDATA is used. - If the -X option is omitted, the environment variable PGXLOG is used - or the postmaster defaults to looking in $PGDATA/pg_xlog. Options for start or restart: -l FILENAME Write (or append) server log to FILENAME. The --- 19,38 ---- or report the status of a PostgreSQL server. Usage: ! $CMDNAME start [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"] $CMDNAME stop [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] ! $CMDNAME restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o \"OPTIONS\"] $CMDNAME reload [-D DATADIR] [-s] $CMDNAME status [-D DATADIR] Common options: -D DATADIR Location of the database storage area -s Only print errors, no informational messages -w Wait until operation completes -W Do not wait until operation completes (The default is to wait for shutdown, but not for start or restart.) If the -D option is omitted, the environment variable PGDATA is used. Options for start or restart: -l FILENAME Write (or append) server log to FILENAME. The *************** *** 134,145 **** # pass environment into new postmaster PGDATA="$1" export PGDATA - ;; - -X) - shift - # pass environment into new postmaster - PGXLOG="$1" - export PGXLOG ;; -l) logfile="$2" --- 131,136 ---- Index: src/bin/pg_resetxlog/pg_resetxlog.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/pg_resetxlog/pg_resetxlog.c,v retrieving revision 1.1 diff -c -r1.1 pg_resetxlog.c *** src/bin/pg_resetxlog/pg_resetxlog.c 17 Aug 2002 02:44:24 -0000 1.1 --- src/bin/pg_resetxlog/pg_resetxlog.c 17 Aug 2002 15:07:16 -0000 *************** *** 67,73 **** static char *DataDir; /* locations of important stuff */ ! static char *XLogDir; static char ControlFilePath[MAXPGPATH]; static ControlFileData ControlFile; /* pg_control values */ --- 67,73 ---- static char *DataDir; /* locations of important stuff */ ! static char XLogDir[MAXPGPATH]; static char ControlFilePath[MAXPGPATH]; static ControlFileData ControlFile; /* pg_control values */ *************** *** 527,533 **** DataDir = argv[argn++]; - XLogDir=malloc(MAXPGPATH); snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir); snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir); --- 527,532 ---- Index: src/include/access/xlog.h =================================================================== RCS file: /cvsroot/pgsql-server/src/include/access/xlog.h,v retrieving revision 1.34 diff -c -r1.34 xlog.h *** src/include/access/xlog.h 6 Aug 2002 02:36:35 -0000 1.34 --- src/include/access/xlog.h 17 Aug 2002 15:07:17 -0000 *************** *** 175,183 **** struct XLogRecData *next; } XLogRecData; - /* XLOG directory name */ - extern char *XLogDir; - extern StartUpID ThisStartUpID; /* current SUI */ extern bool InRecovery; extern XLogRecPtr MyLastRecPtr; --- 175,180 ---- *************** *** 193,199 **** extern char *XLOG_sync_method; extern const char XLOG_sync_method_default[]; - extern void SetXLogDir(char *path); extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info, XLogRecData *rdata); extern void XLogFlush(XLogRecPtr RecPtr); --- 190,195 ----