diff options
author | Vadim B. Mikheev <vadim4o@yahoo.com> | 2000-10-28 16:21:00 +0000 |
---|---|---|
committer | Vadim B. Mikheev <vadim4o@yahoo.com> | 2000-10-28 16:21:00 +0000 |
commit | 5b0740d3fcd55f6e545e8bd577fe8ccba2be4987 (patch) | |
tree | 06cf3807f89c23d365322e08f594e6bbaaa95a3c /src/backend/utils/cache/relcache.c | |
parent | 2f4c9d39febec0c092388b124bf3de2d857eb5a9 (diff) | |
download | postgresql-5b0740d3fcd55f6e545e8bd577fe8ccba2be4987.tar.gz postgresql-5b0740d3fcd55f6e545e8bd577fe8ccba2be4987.zip |
WAL
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r-- | src/backend/utils/cache/relcache.c | 57 |
1 files changed, 56 insertions, 1 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) |