Move global internal files to PGDATA/global.

This commit is contained in:
Peter Eisentraut 2000-07-03 20:48:46 +00:00
parent e2d3932e0e
commit ef5bea51e1
6 changed files with 31 additions and 30 deletions

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.88 2000/06/28 03:31:09 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.89 2000/07/03 20:48:27 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -347,10 +347,8 @@ BootstrapMain(int argc, char *argv[])
*/ */
if (IsUnderPostmaster || xloginit) if (IsUnderPostmaster || xloginit)
{ {
snprintf(XLogDir, MAXPGPATH, "%s%cpg_xlog", snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
DataDir, SEP_CHAR); snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
snprintf(ControlFilePath, MAXPGPATH, "%s%cpg_control",
DataDir, SEP_CHAR);
} }
if (IsUnderPostmaster && xloginit) if (IsUnderPostmaster && xloginit)

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.32 2000/04/12 17:14:55 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.33 2000/07/03 20:48:28 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -37,11 +37,11 @@ relpath(const char *relname)
if (IsSharedSystemRelationName(relname)) if (IsSharedSystemRelationName(relname))
{ {
/* Shared system relations live in DataDir */ /* Shared system relations live in {datadir}/global */
size_t bufsize = strlen(DataDir) + sizeof(NameData) + 2; size_t bufsize = strlen(DataDir) + 8 + sizeof(NameData) + 1;
path = (char *) palloc(bufsize); path = (char *) palloc(bufsize);
snprintf(path, bufsize, "%s%c%s", DataDir, SEP_CHAR, relname); snprintf(path, bufsize, "%s/global/%s", DataDir, relname);
return path; return path;
} }
@ -71,9 +71,9 @@ relpath_blind(const char *dbname, const char *relname,
if (dbid == (Oid) 0) if (dbid == (Oid) 0)
{ {
/* Shared system relations live in DataDir */ /* Shared system relations live in {datadir}/global */
path = (char *) palloc(strlen(DataDir) + sizeof(NameData) + 2); path = (char *) palloc(strlen(DataDir) + 8 + sizeof(NameData) + 1);
sprintf(path, "%s%c%s", DataDir, SEP_CHAR, relname); sprintf(path, "%s/global/%s", DataDir, relname);
} }
else if (dbid == MyDatabaseId) else if (dbid == MyDatabaseId)
{ {

View File

@ -9,7 +9,7 @@
* Dec 17, 1997 - Todd A. Brandys * Dec 17, 1997 - Todd A. Brandys
* Orignal Version Completed. * Orignal Version Completed.
* *
* $Id: crypt.c,v 1.25 2000/06/09 01:11:06 tgl Exp $ * $Id: crypt.c,v 1.26 2000/07/03 20:48:30 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -38,9 +38,9 @@ crypt_getpwdfilename()
static char *pfnam = NULL; static char *pfnam = NULL;
int bufsize; int bufsize;
bufsize = strlen(DataDir) + strlen(CRYPT_PWD_FILE) + 2; bufsize = strlen(DataDir) + 8 + strlen(CRYPT_PWD_FILE) + 1;
pfnam = (char *) palloc(bufsize); pfnam = (char *) palloc(bufsize);
snprintf(pfnam, bufsize, "%s/%s", DataDir, CRYPT_PWD_FILE); snprintf(pfnam, bufsize, "%s/global/%s", DataDir, CRYPT_PWD_FILE);
return pfnam; return pfnam;
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.164 2000/07/03 20:46:00 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.165 2000/07/03 20:48:37 petere Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
@ -1294,10 +1294,8 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
on_proc_exit(UnlinkPidFile, NULL); on_proc_exit(UnlinkPidFile, NULL);
BaseInit(); BaseInit();
snprintf(XLogDir, MAXPGPATH, "%s%cpg_xlog", snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
DataDir, SEP_CHAR); snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
snprintf(ControlFilePath, MAXPGPATH, "%s%cpg_control",
DataDir, SEP_CHAR);
StartupXLOG(); StartupXLOG();
} }
@ -1406,7 +1404,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface "); puts("\nPOSTGRES backend interactive interface ");
puts("$Revision: 1.164 $ $Date: 2000/07/03 20:46:00 $\n"); puts("$Revision: 1.165 $ $Date: 2000/07/03 20:48:37 $\n");
} }
/* /*

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.38 2000/06/02 15:57:34 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.39 2000/07/03 20:48:42 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -143,8 +143,8 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
char *dbfname; char *dbfname;
Form_pg_database tup_db; Form_pg_database tup_db;
dbfname = (char *) palloc(strlen(DataDir) + strlen(DatabaseRelationName) + 2); dbfname = (char *) palloc(strlen(DataDir) + 8 + strlen(DatabaseRelationName) + 2);
sprintf(dbfname, "%s%c%s", DataDir, SEP_CHAR, DatabaseRelationName); sprintf(dbfname, "%s/global/%s", DataDir, DatabaseRelationName);
if ((dbfd = open(dbfname, O_RDONLY | PG_BINARY, 0)) < 0) if ((dbfd = open(dbfname, O_RDONLY | PG_BINARY, 0)) < 0)
elog(FATAL, "cannot open %s: %s", dbfname, strerror(errno)); elog(FATAL, "cannot open %s: %s", dbfname, strerror(errno));

View File

@ -26,7 +26,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.98 2000/07/02 15:21:00 petere Exp $ # $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.99 2000/07/03 20:48:46 petere Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -406,21 +406,26 @@ then
else else
if [ ! -d "$PGDATA" ] if [ ! -d "$PGDATA" ]
then then
echo "Creating database system directory $PGDATA" echo "Creating directory $PGDATA"
mkdir "$PGDATA" || exit_nicely mkdir "$PGDATA" || exit_nicely
else else
echo "Fixing permissions on pre-existing data directory $PGDATA" echo "Fixing permissions on existing directory $PGDATA"
chmod go-rwx "$PGDATA" || exit_nicely chmod go-rwx "$PGDATA" || exit_nicely
fi fi
if [ ! -d "$PGDATA"/base ] if [ ! -d "$PGDATA"/base ]
then then
echo "Creating database system directory $PGDATA/base" echo "Creating directory $PGDATA/base"
mkdir "$PGDATA"/base || exit_nicely mkdir "$PGDATA"/base || exit_nicely
fi fi
if [ ! -d "$PGDATA"/global ]
then
echo "Creating directory $PGDATA/global"
mkdir "$PGDATA"/global || exit_nicely
fi
if [ ! -d "$PGDATA"/pg_xlog ] if [ ! -d "$PGDATA"/pg_xlog ]
then then
echo "Creating database XLOG directory $PGDATA/pg_xlog" echo "Creating directory $PGDATA/pg_xlog"
mkdir "$PGDATA"/pg_xlog || exit_nicely mkdir "$PGDATA"/pg_xlog || exit_nicely
fi fi
fi fi
@ -458,7 +463,7 @@ echo $short_version > "$PGDATA"/base/template1/PG_VERSION || exit_nicely
if [ "$template_only" -eq 0 ] if [ "$template_only" -eq 0 ]
then then
echo "Creating global relations in $PGDATA/base" echo "Creating global relations in $PGDATA/global"
[ "$debug" -ne 0 ] && echo "Running: $PGPATH/postgres $BACKENDARGS template1" [ "$debug" -ne 0 ] && echo "Running: $PGPATH/postgres $BACKENDARGS template1"
cat "$GLOBAL" \ cat "$GLOBAL" \