diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/nodes/plannodes.h | 5 | ||||
| -rw-r--r-- | src/include/storage/sinval.h | 25 | ||||
| -rw-r--r-- | src/include/utils/catcache.h | 6 | ||||
| -rw-r--r-- | src/include/utils/inval.h | 8 |
4 files changed, 19 insertions, 25 deletions
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 7c085b3f4f6..852ef775309 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -17,7 +17,6 @@ #include "access/sdir.h" #include "nodes/bitmapset.h" #include "nodes/primnodes.h" -#include "storage/itemptr.h" /* ---------------------------------------------------------------- @@ -793,13 +792,13 @@ typedef struct PlanRowMark * relations are recorded as a simple list of OIDs, and everything else * is represented as a list of PlanInvalItems. A PlanInvalItem is designed * to be used with the syscache invalidation mechanism, so it identifies a - * system catalog entry by cache ID and tuple TID. + * system catalog entry by cache ID and hash value. */ typedef struct PlanInvalItem { NodeTag type; int cacheId; /* a syscache ID, see utils/syscache.h */ - ItemPointerData tupleId; /* TID of the object's catalog tuple */ + uint32 hashValue; /* hash value of object's cache lookup key */ } PlanInvalItem; #endif /* PLANNODES_H */ diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h index aba474d2371..b468468fa48 100644 --- a/src/include/storage/sinval.h +++ b/src/include/storage/sinval.h @@ -14,7 +14,6 @@ #ifndef SINVAL_H #define SINVAL_H -#include "storage/itemptr.h" #include "storage/relfilenode.h" @@ -32,22 +31,17 @@ * * Catcache inval events are initially driven by detecting tuple inserts, * updates and deletions in system catalogs (see CacheInvalidateHeapTuple). - * An update generates two inval events, one for the old tuple and one for - * the new --- this is needed to get rid of both positive entries for the - * old tuple, and negative cache entries associated with the new tuple's - * cache key. (This could perhaps be optimized down to one event when the - * cache key is not changing, but for now we don't bother to try.) Note that - * the inval events themselves don't actually say whether the tuple is being - * inserted or deleted. + * An update can generate two inval events, one for the old tuple and one for + * the new, but this is reduced to one event if the tuple's hash key doesn't + * change. Note that the inval events themselves don't actually say whether + * the tuple is being inserted or deleted. Also, since we transmit only a + * hash key, there is a small risk of unnecessary invalidations due to chance + * matches of hash keys. * * Note that some system catalogs have multiple caches on them (with different * indexes). On detecting a tuple invalidation in such a catalog, separate - * catcache inval messages must be generated for each of its caches. The - * catcache inval messages carry the hash value for the target tuple, so - * that the catcache only needs to search one hash chain not all its chains, - * and so that negative cache entries can be recognized with good accuracy. - * (Of course this assumes that all the backends are using identical hashing - * code, but that should be OK.) + * catcache inval messages must be generated for each of its caches, since + * the hash keys will generally be different. * * Catcache and relcache invalidations are transactional, and so are sent * to other backends upon commit. Internally to the generating backend, @@ -62,9 +56,7 @@ typedef struct { - /* note: field layout chosen with an eye to alignment concerns */ int8 id; /* cache ID --- must be first */ - ItemPointerData tuplePtr; /* tuple identifier in cached relation */ Oid dbId; /* database ID, or 0 if a shared relation */ uint32 hashValue; /* hash value of key for this catcache */ } SharedInvalCatcacheMsg; @@ -91,6 +83,7 @@ typedef struct typedef struct { + /* note: field layout chosen to pack into 16 bytes */ int8 id; /* type field --- must be first */ int8 backend_hi; /* high bits of backend ID, if temprel */ uint16 backend_lo; /* low bits of backend ID, if temprel */ diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h index 7a990528e75..84163d0b7fb 100644 --- a/src/include/utils/catcache.h +++ b/src/include/utils/catcache.h @@ -181,11 +181,11 @@ extern void ReleaseCatCacheList(CatCList *list); extern void ResetCatalogCaches(void); extern void CatalogCacheFlushCatalog(Oid catId); -extern void CatalogCacheIdInvalidate(int cacheId, uint32 hashValue, - ItemPointer pointer); +extern void CatalogCacheIdInvalidate(int cacheId, uint32 hashValue); extern void PrepareToInvalidateCacheTuple(Relation relation, HeapTuple tuple, - void (*function) (int, uint32, ItemPointer, Oid)); + HeapTuple newtuple, + void (*function) (int, uint32, Oid)); extern void PrintCatCacheLeakWarning(HeapTuple tuple); extern void PrintCatCacheListLeakWarning(CatCList *list); diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h index dda2a63d6e1..606b778f10e 100644 --- a/src/include/utils/inval.h +++ b/src/include/utils/inval.h @@ -19,7 +19,7 @@ #include "utils/relcache.h" -typedef void (*SyscacheCallbackFunction) (Datum arg, int cacheid, ItemPointer tuplePtr); +typedef void (*SyscacheCallbackFunction) (Datum arg, int cacheid, uint32 hashvalue); typedef void (*RelcacheCallbackFunction) (Datum arg, Oid relid); @@ -39,7 +39,9 @@ extern void PostPrepare_Inval(void); extern void CommandEndInvalidationMessages(void); -extern void CacheInvalidateHeapTuple(Relation relation, HeapTuple tuple); +extern void CacheInvalidateHeapTuple(Relation relation, + HeapTuple tuple, + HeapTuple newtuple); extern void CacheInvalidateCatalog(Oid catalogId); @@ -60,7 +62,7 @@ extern void CacheRegisterSyscacheCallback(int cacheid, extern void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, Datum arg); -extern void CallSyscacheCallbacks(int cacheid, ItemPointer tuplePtr); +extern void CallSyscacheCallbacks(int cacheid, uint32 hashvalue); extern void inval_twophase_postcommit(TransactionId xid, uint16 info, void *recdata, uint32 len); |
