diff options
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/cache/relcache.c | 57 | ||||
-rw-r--r-- | src/backend/utils/init/postinit.c | 9 |
2 files changed, 61 insertions, 5 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index de3e3c4a8d3..ea7a8d0212c 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.113 2000/10/23 04:10:08 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.114 2000/10/28 16:20:57 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -2064,7 +2064,62 @@ RelationCacheInitializePhase2(void) } } +#ifdef XLOG /* used by XLogInitCache */ +void CreateDummyCaches(void); +void DestroyDummyCaches(void); + +void +CreateDummyCaches(void) +{ + MemoryContext oldcxt; + HASHCTL ctl; + + if (!CacheMemoryContext) + CreateCacheMemoryContext(); + + oldcxt = MemoryContextSwitchTo(CacheMemoryContext); + + MemSet(&ctl, 0, (int) sizeof(ctl)); + ctl.keysize = sizeof(NameData); + ctl.datasize = sizeof(Relation); + RelationNameCache = hash_create(INITRELCACHESIZE, &ctl, HASH_ELEM); + + ctl.keysize = sizeof(Oid); + ctl.hash = tag_hash; + RelationIdCache = hash_create(INITRELCACHESIZE, &ctl, + HASH_ELEM | HASH_FUNCTION); + + ctl.keysize = sizeof(RelFileNode); + ctl.hash = tag_hash; + RelationNodeCache = hash_create(INITRELCACHESIZE, &ctl, + HASH_ELEM | HASH_FUNCTION); + MemoryContextSwitchTo(oldcxt); +} + +void +DestroyDummyCaches(void) +{ + MemoryContext oldcxt; + + if (!CacheMemoryContext) + return; + + oldcxt = MemoryContextSwitchTo(CacheMemoryContext); + + if (RelationNameCache) + hash_destroy(RelationNameCache); + if (RelationIdCache) + hash_destroy(RelationIdCache); + if (RelationNodeCache) + hash_destroy(RelationNodeCache); + + RelationNameCache = RelationIdCache = RelationNodeCache = NULL; + + MemoryContextSwitchTo(oldcxt); +} + +#endif /* XLOG */ static void AttrDefaultFetch(Relation relation) diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index cee8dfaac90..fbc9cc2ab2c 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.68 2000/10/16 14:52:15 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.69 2000/10/28 16:20:58 vadim Exp $ * * *------------------------------------------------------------------------- @@ -231,9 +231,6 @@ InitPostgres(const char *dbname, const char *username) { bool bootstrap = IsBootstrapProcessingMode(); - /* initialize the local buffer manager */ - InitLocalBuffer(); - #ifndef XLOG if (!TransactionFlushEnabled()) on_shmem_exit(FlushBufferPool, 0); @@ -414,4 +411,8 @@ BaseInit(void) smgrinit(); EnablePortalManager(); /* memory for portal/transaction stuff */ + + /* initialize the local buffer manager */ + InitLocalBuffer(); + } |