From 0fc4ecf93543a0e293845bdc47712285a9165aa0 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 26 Feb 2005 18:43:34 +0000 Subject: Finish up the flat-files project: get rid of GetRawDatabaseInfo() hack in favor of looking at the flat file copy of pg_database during backend startup. This should finally eliminate the various corner cases in which backend startup fails unexpectedly because it isn't able to distinguish live and dead tuples in pg_database. Simplify locking on pg_database to be similar to the rules used with pg_shadow and pg_group, and eliminate FlushRelationBuffers operations that were used only to reduce the odds of failure of GetRawDatabaseInfo. initdb forced due to addition of a trigger to pg_database. --- src/backend/utils/init/flatfiles.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/backend/utils/init/flatfiles.c') diff --git a/src/backend/utils/init/flatfiles.c b/src/backend/utils/init/flatfiles.c index 8968d572c88..e7ddd0a42c1 100644 --- a/src/backend/utils/init/flatfiles.c +++ b/src/backend/utils/init/flatfiles.c @@ -22,7 +22,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.3 2005/02/20 22:02:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.4 2005/02/26 18:43:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -243,10 +243,12 @@ write_database_file(Relation drel) Form_pg_database dbform = (Form_pg_database) GETSTRUCT(tuple); char *datname; Oid datoid; + Oid dattablespace; TransactionId datfrozenxid; datname = NameStr(dbform->datname); datoid = HeapTupleGetOid(tuple); + dattablespace = dbform->dattablespace; datfrozenxid = dbform->datfrozenxid; /* @@ -276,13 +278,13 @@ write_database_file(Relation drel) } /* - * The file format is: "dbname" oid frozenxid + * The file format is: "dbname" oid tablespace frozenxid * * The xid is not needed for backend startup, but may be of use * for forensic purposes. */ fputs_quote(datname, fp); - fprintf(fp, " %u %u\n", datoid, datfrozenxid); + fprintf(fp, " %u %u %u\n", datoid, dattablespace, datfrozenxid); } heap_endscan(scan); @@ -830,15 +832,3 @@ flatfile_update_trigger(PG_FUNCTION_ARGS) return PointerGetDatum(NULL); } - - -/* - * Old version of trigger --- remove after we can force an initdb - */ -extern Datum update_pg_pwd_and_pg_group(PG_FUNCTION_ARGS); - -Datum -update_pg_pwd_and_pg_group(PG_FUNCTION_ARGS) -{ - return flatfile_update_trigger(fcinfo); -} -- cgit v1.2.3