diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-08-12 20:53:31 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-08-12 20:53:31 +0000 |
| commit | 04011cc97060798a5d28219b731b3603dd112ab6 (patch) | |
| tree | 8d001affc00fefdccb7d0a400fc146d9da8ed6b2 /src/backend/storage/lmgr/proc.c | |
| parent | a1f0c9bab99edc6029dee3bf702348aa7eab0099 (diff) | |
| download | postgresql-04011cc97060798a5d28219b731b3603dd112ab6.tar.gz | |
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.
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
| -rw-r--r-- | src/backend/storage/lmgr/proc.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 4ae977154a..d9a0a689f8 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.207 2009/06/11 14:49:02 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.208 2009/08/12 20:53:30 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -332,8 +332,8 @@ InitProcess(void) * InitProcessPhase2 -- make MyProc visible in the shared ProcArray. * * This is separate from InitProcess because we can't acquire LWLocks until - * we've created a PGPROC, but in the EXEC_BACKEND case there is a good deal - * of stuff to be done before this step that will require LWLock access. + * we've created a PGPROC, but in the EXEC_BACKEND case ProcArrayAdd won't + * work until after we've done CreateSharedMemoryAndSemaphores. */ void InitProcessPhase2(void) @@ -341,14 +341,6 @@ InitProcessPhase2(void) Assert(MyProc != NULL); /* - * We should now know what database we're in, so advertise that. (We need - * not do any locking here, since no other backend can yet see our - * PGPROC.) - */ - Assert(OidIsValid(MyDatabaseId)); - MyProc->databaseId = MyDatabaseId; - - /* * Add our PGPROC to the PGPROC array in shared memory. */ ProcArrayAdd(MyProc); |
