mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Allow backends to start up without use of the flat-file copy of pg_database.
To make this work in the base case, pg_database now has a nailed-in-cache relation descriptor that is initialized using hardwired knowledge in relcache.c. This means pg_database is added to the set of relations that need to have a Schema_pg_xxx macro maintained in pg_attribute.h. When this path is taken, we'll have to do a seqscan of pg_database to find the row we need. In the normal case, we are able to do an indexscan to find the database's row by name. This is made possible by storing a global relcache init file that describes only the shared catalogs and their indexes (and therefore is usable by all backends in any database). A new backend loads this cache file, finds its database OID after an indexscan on pg_database, and then loads the local relcache init file for that database. This change should effectively eliminate number of databases as a factor in backend startup time, even with large numbers of databases. However, the real reason for doing it is as a first step towards getting rid of the flat files altogether. There are still several other sub-projects to be tackled before that can happen.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.63 2009/01/01 17:24:02 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/utils/relcache.h,v 1.64 2009/08/12 20:53:31 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -54,6 +54,7 @@ extern void RelationInitIndexAccessInfo(Relation relation);
|
||||
*/
|
||||
extern void RelationCacheInitialize(void);
|
||||
extern void RelationCacheInitializePhase2(void);
|
||||
extern void RelationCacheInitializePhase3(void);
|
||||
|
||||
/*
|
||||
* Routine to create a relcache entry for an about-to-be-created relation
|
||||
@ -81,13 +82,15 @@ extern void AtEOSubXact_RelationCache(bool isCommit, SubTransactionId mySubid,
|
||||
extern void RelationCacheMarkNewRelfilenode(Relation rel);
|
||||
|
||||
/*
|
||||
* Routines to help manage rebuilding of relcache init file
|
||||
* Routines to help manage rebuilding of relcache init files
|
||||
*/
|
||||
extern bool RelationIdIsInInitFile(Oid relationId);
|
||||
extern void RelationCacheInitFileInvalidate(bool beforeSend);
|
||||
extern void RelationCacheInitFileRemove(const char *dbPath);
|
||||
extern void RelationCacheInitFileRemove(void);
|
||||
|
||||
/* should be used only by relcache.c and catcache.c */
|
||||
extern bool criticalRelcachesBuilt;
|
||||
/* should be used only by relcache.c and postinit.c */
|
||||
extern bool criticalSharedRelcachesBuilt;
|
||||
|
||||
#endif /* RELCACHE_H */
|
||||
|
Reference in New Issue
Block a user