diff options
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r-- | src/backend/utils/cache/inval.c | 6 | ||||
-rw-r--r-- | src/backend/utils/cache/relcache.c | 35 |
2 files changed, 27 insertions, 14 deletions
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index 2195458982..61b7522f8c 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -80,7 +80,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.70 2005/01/10 21:57:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.71 2005/04/14 01:38:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -541,7 +541,7 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple) */ tupleRelId = RelationGetRelid(relation); - if (tupleRelId == RelOid_pg_class) + if (tupleRelId == RelationRelationId) { Form_pg_class classtup = (Form_pg_class) GETSTRUCT(tuple); RelFileNode rnode; @@ -575,7 +575,7 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple) rnode.relNode = classtup->relfilenode; RegisterSmgrInvalidation(rnode); } - else if (tupleRelId == RelOid_pg_attribute) + else if (tupleRelId == AttributeRelationId) { Form_pg_attribute atttup = (Form_pg_attribute) GETSTRUCT(tuple); diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 109a6e811a..e6c59b1815 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.218 2005/03/29 00:17:11 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.219 2005/04/14 01:38:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2150,18 +2150,36 @@ RelationBuildLocalRelation(const char *relname, TupleDesc tupDesc, Oid relid, Oid reltablespace, - bool shared_relation, - bool nailit) + bool shared_relation) { Relation rel; MemoryContext oldcxt; int natts = tupDesc->natts; int i; bool has_not_null; + bool nailit; AssertArg(natts >= 0); /* + * check for creation of a rel that must be nailed in cache. + * + * XXX this list had better match RelationCacheInitialize's list. + */ + switch (relid) + { + case RelationRelationId: + case AttributeRelationId: + case ProcedureRelationId: + case TypeRelationId: + nailit = true; + break; + default: + nailit = false; + break; + } + + /* * switch to the cache context to create the relcache entry. */ if (!CacheMemoryContext) @@ -2179,6 +2197,9 @@ RelationBuildLocalRelation(const char *relname, /* make sure relation is marked as having no open file yet */ rel->rd_smgr = NULL; + /* mark it nailed if appropriate */ + rel->rd_isnailed = nailit; + rel->rd_refcnt = nailit ? 1 : 0; /* it's being created in this transaction */ @@ -2191,14 +2212,6 @@ RelationBuildLocalRelation(const char *relname, rel->rd_istemp = isTempNamespace(relnamespace); /* - * nail the reldesc if this is a bootstrap create reln and we may need - * it in the cache later on in the bootstrap process so we don't ever - * want it kicked out. e.g. pg_attribute!!! - */ - if (nailit) - rel->rd_isnailed = true; - - /* * create a new tuple descriptor from the one passed in. We do this * partly to copy it into the cache context, and partly because the * new relation can't have any defaults or constraints yet; they have |