aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/cache/catcache.c89
-rw-r--r--src/backend/utils/cache/relcache.c11
-rw-r--r--src/backend/utils/cache/syscache.c68
-rw-r--r--src/include/utils/catcache.h5
4 files changed, 6 insertions, 167 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index aac1e87d87e..8851e23661b 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.149 2010/02/07 20:48:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.150 2010/02/08 05:53:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -673,91 +673,6 @@ ResetCatalogCaches(void)
}
/*
- * CatalogCacheFlushRelation
- *
- * This is called by RelationFlushRelation() to clear out cached information
- * about a relation being dropped. (This could be a DROP TABLE command,
- * or a temp table being dropped at end of transaction, or a table created
- * during the current transaction that is being dropped because of abort.)
- * Remove all cache entries relevant to the specified relation OID.
- */
-void
-CatalogCacheFlushRelation(Oid relId)
-{
- CatCache *cache;
-
- CACHE2_elog(DEBUG2, "CatalogCacheFlushRelation called for %u", relId);
-
- for (cache = CacheHdr->ch_caches; cache; cache = cache->cc_next)
- {
- int i;
-
- /* We can ignore uninitialized caches, since they must be empty */
- if (cache->cc_tupdesc == NULL)
- continue;
-
- /* Does this cache store tuples associated with relations at all? */
- if (cache->cc_reloidattr == 0)
- continue; /* nope, leave it alone */
-
- /* Yes, scan the tuples and remove those related to relId */
- for (i = 0; i < cache->cc_nbuckets; i++)
- {
- Dlelem *elt,
- *nextelt;
-
- for (elt = DLGetHead(&cache->cc_bucket[i]); elt; elt = nextelt)
- {
- CatCTup *ct = (CatCTup *) DLE_VAL(elt);
- Oid tupRelid;
-
- nextelt = DLGetSucc(elt);
-
- /*
- * Negative entries are never considered related to a rel,
- * even if the rel is part of their lookup key.
- */
- if (ct->negative)
- continue;
-
- if (cache->cc_reloidattr == ObjectIdAttributeNumber)
- tupRelid = HeapTupleGetOid(&ct->tuple);
- else
- {
- bool isNull;
-
- tupRelid =
- DatumGetObjectId(fastgetattr(&ct->tuple,
- cache->cc_reloidattr,
- cache->cc_tupdesc,
- &isNull));
- Assert(!isNull);
- }
-
- if (tupRelid == relId)
- {
- if (ct->refcount > 0 ||
- (ct->c_list && ct->c_list->refcount > 0))
- {
- ct->dead = true;
- /* parent list must be considered dead too */
- if (ct->c_list)
- ct->c_list->dead = true;
- }
- else
- CatCacheRemoveCTup(cache, ct);
-#ifdef CATCACHE_STATS
- cache->cc_invals++;
-#endif
- }
- }
- }
- }
-
- CACHE1_elog(DEBUG2, "end of CatalogCacheFlushRelation call");
-}
-
-/*
* CatalogCacheFlushCatalog
*
* Flush all catcache entries that came from the specified system catalog.
@@ -820,7 +735,6 @@ CatCache *
InitCatCache(int id,
Oid reloid,
Oid indexoid,
- int reloidattr,
int nkeys,
const int *key,
int nbuckets)
@@ -884,7 +798,6 @@ InitCatCache(int id,
cp->cc_indexoid = indexoid;
cp->cc_relisshared = false; /* temporary */
cp->cc_tupdesc = (TupleDesc) NULL;
- cp->cc_reloidattr = reloidattr;
cp->cc_ntup = 0;
cp->cc_nbuckets = nbuckets;
cp->cc_nkeys = nkeys;
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index ff85195ed13..6137b096772 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.303 2010/02/07 20:48:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.304 2010/02/08 05:53:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1917,13 +1917,6 @@ RelationClearRelation(Relation relation, bool rebuild)
relation->rd_isvalid = false;
/*
- * Clear out catcache's entries for this relation. This is a bit of
- * a hack, but it's a convenient place to do it. (XXX do we really
- * still need this?)
- */
- CatalogCacheFlushRelation(RelationGetRelid(relation));
-
- /*
* If we're really done with the relcache entry, blow it away. But if
* someone is still using it, reconstruct the whole deal without moving
* the physical RelationData record (so that the someone's pointer is
@@ -2468,8 +2461,6 @@ RelationBuildLocalRelation(const char *relname,
*
* XXX this list had better match the relations specially handled in
* RelationCacheInitializePhase2/3.
- *
- * XXX do we need this at all??
*/
switch (relid)
{
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index f35712732b2..c04db4f02f9 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.124 2010/01/05 21:53:59 rhaas Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/syscache.c,v 1.125 2010/02/08 05:53:55 tgl Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -64,12 +64,8 @@
Add your entry to the cacheinfo[] array below. All cache lists are
alphabetical, so add it in the proper place. Specify the relation OID,
- index OID, number of keys, key attribute numbers, and number of hash
- buckets. If the relation contains tuples that are associated with a
- particular relation (for example, its attributes, rules, triggers, etc)
- then specify the attribute number that contains the OID of the associated
- relation. This is used by CatalogCacheFlushRelation() to remove the
- correct tuples during a table drop or relcache invalidation event.
+ index OID, number of keys, key attribute numbers, and initial number of
+ hash buckets.
The number of hash buckets must be a power of 2. It's reasonable to
set this to the number of entries that might be in the particular cache
@@ -98,7 +94,6 @@ struct cachedesc
{
Oid reloid; /* OID of the relation being cached */
Oid indoid; /* OID of index relation for this cache */
- int reloidattr; /* attr number of rel OID reference, or 0 */
int nkeys; /* # of keys needed for cache lookup */
int key[4]; /* attribute numbers of key attrs */
int nbuckets; /* number of hash buckets for this cache */
@@ -107,7 +102,6 @@ struct cachedesc
static const struct cachedesc cacheinfo[] = {
{AggregateRelationId, /* AGGFNOID */
AggregateFnoidIndexId,
- 0,
1,
{
Anum_pg_aggregate_aggfnoid,
@@ -119,7 +113,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodRelationId, /* AMNAME */
AmNameIndexId,
- 0,
1,
{
Anum_pg_am_amname,
@@ -131,7 +124,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodRelationId, /* AMOID */
AmOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -143,7 +135,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodOperatorRelationId, /* AMOPOPID */
AccessMethodOperatorIndexId,
- 0,
2,
{
Anum_pg_amop_amopopr,
@@ -155,7 +146,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodOperatorRelationId, /* AMOPSTRATEGY */
AccessMethodStrategyIndexId,
- 0,
4,
{
Anum_pg_amop_amopfamily,
@@ -167,7 +157,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AccessMethodProcedureRelationId, /* AMPROCNUM */
AccessMethodProcedureIndexId,
- 0,
4,
{
Anum_pg_amproc_amprocfamily,
@@ -179,7 +168,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AttributeRelationId, /* ATTNAME */
AttributeRelidNameIndexId,
- Anum_pg_attribute_attrelid,
2,
{
Anum_pg_attribute_attrelid,
@@ -191,7 +179,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AttributeRelationId, /* ATTNUM */
AttributeRelidNumIndexId,
- Anum_pg_attribute_attrelid,
2,
{
Anum_pg_attribute_attrelid,
@@ -203,7 +190,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthMemRelationId, /* AUTHMEMMEMROLE */
AuthMemMemRoleIndexId,
- 0,
2,
{
Anum_pg_auth_members_member,
@@ -215,7 +201,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthMemRelationId, /* AUTHMEMROLEMEM */
AuthMemRoleMemIndexId,
- 0,
2,
{
Anum_pg_auth_members_roleid,
@@ -227,7 +212,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthIdRelationId, /* AUTHNAME */
AuthIdRolnameIndexId,
- 0,
1,
{
Anum_pg_authid_rolname,
@@ -239,7 +223,6 @@ static const struct cachedesc cacheinfo[] = {
},
{AuthIdRelationId, /* AUTHOID */
AuthIdOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -252,7 +235,6 @@ static const struct cachedesc cacheinfo[] = {
{
CastRelationId, /* CASTSOURCETARGET */
CastSourceTargetIndexId,
- 0,
2,
{
Anum_pg_cast_castsource,
@@ -264,7 +246,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorClassRelationId, /* CLAAMNAMENSP */
OpclassAmNameNspIndexId,
- 0,
3,
{
Anum_pg_opclass_opcmethod,
@@ -276,7 +257,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorClassRelationId, /* CLAOID */
OpclassOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -288,7 +268,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConversionRelationId, /* CONDEFAULT */
ConversionDefaultIndexId,
- 0,
4,
{
Anum_pg_conversion_connamespace,
@@ -300,7 +279,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConversionRelationId, /* CONNAMENSP */
ConversionNameNspIndexId,
- 0,
2,
{
Anum_pg_conversion_conname,
@@ -312,7 +290,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConstraintRelationId, /* CONSTROID */
ConstraintOidIndexId,
- Anum_pg_constraint_conrelid,
1,
{
ObjectIdAttributeNumber,
@@ -324,7 +301,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ConversionRelationId, /* CONVOID */
ConversionOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -336,7 +312,6 @@ static const struct cachedesc cacheinfo[] = {
},
{DatabaseRelationId, /* DATABASEOID */
DatabaseOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -348,7 +323,6 @@ static const struct cachedesc cacheinfo[] = {
},
{DefaultAclRelationId, /* DEFACLROLENSPOBJ */
DefaultAclRoleNspObjIndexId,
- 0,
3,
{
Anum_pg_default_acl_defaclrole,
@@ -360,7 +334,6 @@ static const struct cachedesc cacheinfo[] = {
},
{EnumRelationId, /* ENUMOID */
EnumOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -372,7 +345,6 @@ static const struct cachedesc cacheinfo[] = {
},
{EnumRelationId, /* ENUMTYPOIDNAME */
EnumTypIdLabelIndexId,
- 0,
2,
{
Anum_pg_enum_enumtypid,
@@ -384,7 +356,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */
ForeignDataWrapperNameIndexId,
- 0,
1,
{
Anum_pg_foreign_data_wrapper_fdwname,
@@ -396,7 +367,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */
ForeignDataWrapperOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -408,7 +378,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignServerRelationId, /* FOREIGNSERVERNAME */
ForeignServerNameIndexId,
- 0,
1,
{
Anum_pg_foreign_server_srvname,
@@ -420,7 +389,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ForeignServerRelationId, /* FOREIGNSERVEROID */
ForeignServerOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -432,7 +400,6 @@ static const struct cachedesc cacheinfo[] = {
},
{IndexRelationId, /* INDEXRELID */
IndexRelidIndexId,
- Anum_pg_index_indrelid,
1,
{
Anum_pg_index_indexrelid,
@@ -444,7 +411,6 @@ static const struct cachedesc cacheinfo[] = {
},
{LanguageRelationId, /* LANGNAME */
LanguageNameIndexId,
- 0,
1,
{
Anum_pg_language_lanname,
@@ -456,7 +422,6 @@ static const struct cachedesc cacheinfo[] = {
},
{LanguageRelationId, /* LANGOID */
LanguageOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -468,7 +433,6 @@ static const struct cachedesc cacheinfo[] = {
},
{NamespaceRelationId, /* NAMESPACENAME */
NamespaceNameIndexId,
- 0,
1,
{
Anum_pg_namespace_nspname,
@@ -480,7 +444,6 @@ static const struct cachedesc cacheinfo[] = {
},
{NamespaceRelationId, /* NAMESPACEOID */
NamespaceOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -492,7 +455,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorRelationId, /* OPERNAMENSP */
OperatorNameNspIndexId,
- 0,
4,
{
Anum_pg_operator_oprname,
@@ -504,7 +466,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorRelationId, /* OPEROID */
OperatorOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -516,7 +477,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorFamilyRelationId, /* OPFAMILYAMNAMENSP */
OpfamilyAmNameNspIndexId,
- 0,
3,
{
Anum_pg_opfamily_opfmethod,
@@ -528,7 +488,6 @@ static const struct cachedesc cacheinfo[] = {
},
{OperatorFamilyRelationId, /* OPFAMILYOID */
OpfamilyOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -540,7 +499,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ProcedureRelationId, /* PROCNAMEARGSNSP */
ProcedureNameArgsNspIndexId,
- 0,
3,
{
Anum_pg_proc_proname,
@@ -552,7 +510,6 @@ static const struct cachedesc cacheinfo[] = {
},
{ProcedureRelationId, /* PROCOID */
ProcedureOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -564,7 +521,6 @@ static const struct cachedesc cacheinfo[] = {
},
{RelationRelationId, /* RELNAMENSP */
ClassNameNspIndexId,
- ObjectIdAttributeNumber,
2,
{
Anum_pg_class_relname,
@@ -576,7 +532,6 @@ static const struct cachedesc cacheinfo[] = {
},
{RelationRelationId, /* RELOID */
ClassOidIndexId,
- ObjectIdAttributeNumber,
1,
{
ObjectIdAttributeNumber,
@@ -588,7 +543,6 @@ static const struct cachedesc cacheinfo[] = {
},
{RewriteRelationId, /* RULERELNAME */
RewriteRelRulenameIndexId,
- Anum_pg_rewrite_ev_class,
2,
{
Anum_pg_rewrite_ev_class,
@@ -600,7 +554,6 @@ static const struct cachedesc cacheinfo[] = {
},
{StatisticRelationId, /* STATRELATTINH */
StatisticRelidAttnumInhIndexId,
- Anum_pg_statistic_starelid,
3,
{
Anum_pg_statistic_starelid,
@@ -612,7 +565,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TableSpaceRelationId, /* TABLESPACEOID */
TablespaceOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -624,7 +576,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSConfigMapRelationId, /* TSCONFIGMAP */
TSConfigMapIndexId,
- 0,
3,
{
Anum_pg_ts_config_map_mapcfg,
@@ -636,7 +587,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSConfigRelationId, /* TSCONFIGNAMENSP */
TSConfigNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_config_cfgname,
@@ -648,7 +598,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSConfigRelationId, /* TSCONFIGOID */
TSConfigOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -660,7 +609,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSDictionaryRelationId, /* TSDICTNAMENSP */
TSDictionaryNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_dict_dictname,
@@ -672,7 +620,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSDictionaryRelationId, /* TSDICTOID */
TSDictionaryOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -684,7 +631,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSParserRelationId, /* TSPARSERNAMENSP */
TSParserNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_parser_prsname,
@@ -696,7 +642,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSParserRelationId, /* TSPARSEROID */
TSParserOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -708,7 +653,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSTemplateRelationId, /* TSTEMPLATENAMENSP */
TSTemplateNameNspIndexId,
- 0,
2,
{
Anum_pg_ts_template_tmplname,
@@ -720,7 +664,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TSTemplateRelationId, /* TSTEMPLATEOID */
TSTemplateOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -732,7 +675,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TypeRelationId, /* TYPENAMENSP */
TypeNameNspIndexId,
- Anum_pg_type_typrelid,
2,
{
Anum_pg_type_typname,
@@ -744,7 +686,6 @@ static const struct cachedesc cacheinfo[] = {
},
{TypeRelationId, /* TYPEOID */
TypeOidIndexId,
- Anum_pg_type_typrelid,
1,
{
ObjectIdAttributeNumber,
@@ -756,7 +697,6 @@ static const struct cachedesc cacheinfo[] = {
},
{UserMappingRelationId, /* USERMAPPINGOID */
UserMappingOidIndexId,
- 0,
1,
{
ObjectIdAttributeNumber,
@@ -768,7 +708,6 @@ static const struct cachedesc cacheinfo[] = {
},
{UserMappingRelationId, /* USERMAPPINGUSERSERVER */
UserMappingUserServerIndexId,
- 0,
2,
{
Anum_pg_user_mapping_umuser,
@@ -808,7 +747,6 @@ InitCatalogCache(void)
SysCache[cacheId] = InitCatCache(cacheId,
cacheinfo[cacheId].reloid,
cacheinfo[cacheId].indoid,
- cacheinfo[cacheId].reloidattr,
cacheinfo[cacheId].nkeys,
cacheinfo[cacheId].key,
cacheinfo[cacheId].nbuckets);
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index 6d77c4a7d1c..27f46083f42 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.70 2010/02/07 20:48:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/utils/catcache.h,v 1.71 2010/02/08 05:53:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,6 @@ typedef struct catcache
Oid cc_indexoid; /* OID of index matching cache keys */
bool cc_relisshared; /* is relation shared across databases? */
TupleDesc cc_tupdesc; /* tuple descriptor (copied from reldesc) */
- int cc_reloidattr; /* AttrNumber of relation OID attr, or 0 */
int cc_ntup; /* # of tuples currently in this cache */
int cc_nbuckets; /* # of hash buckets in this cache */
int cc_nkeys; /* # of keys (1..4) */
@@ -163,7 +162,6 @@ extern void CreateCacheMemoryContext(void);
extern void AtEOXact_CatCache(bool isCommit);
extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid,
- int reloidattr,
int nkeys, const int *key,
int nbuckets);
extern void InitCatCachePhase2(CatCache *cache, bool touch_index);
@@ -179,7 +177,6 @@ extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys,
extern void ReleaseCatCacheList(CatCList *list);
extern void ResetCatalogCaches(void);
-extern void CatalogCacheFlushRelation(Oid relId);
extern void CatalogCacheFlushCatalog(Oid catId);
extern void CatalogCacheIdInvalidate(int cacheId, uint32 hashValue,
ItemPointer pointer);