mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
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.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user