1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

Remove CatalogCacheFlushRelation, and the reloidattr infrastructure that was

needed by nothing else.

The restructuring I just finished doing on cache management exposed to me how
silly this routine was.  Its function was to go into the catcache and blow
away all entries related to a given relation when there was a relcache flush
on that relation.  However, there is no point in removing a catcache entry
if the catalog row it represents is still valid --- and if it isn't valid,
there must have been a catcache entry flush on it, because that's triggered
directly by heap_update or heap_delete on the catalog row.  So this routine
accomplished nothing except to blow away valid cache entries that we'd very
likely be wanting in the near future to help reconstruct the relcache entry.
Dumb.

On top of which, it required a subtle and easy-to-get-wrong attribute in
syscache definitions, ie, the column containing the OID of the related
relation if any.  Removing that is a very useful maintenance simplification.
This commit is contained in:
Tom Lane
2010-02-08 05:53:55 +00:00
parent 68446b2c87
commit 9a75803b1a
4 changed files with 6 additions and 167 deletions

View File

@@ -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);