aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/plancache.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-08-16 19:27:46 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-08-16 19:27:46 -0400
commitb5282aa893e565b7844f8237462cb843438cdd5e (patch)
treeb19170597a0a94685cc8c978c1c5800c411d02d1 /src/backend/utils/cache/plancache.c
parent632ae6829f7abda34e15082c91d9dfb3fc0f298b (diff)
downloadpostgresql-b5282aa893e565b7844f8237462cb843438cdd5e.tar.gz
postgresql-b5282aa893e565b7844f8237462cb843438cdd5e.zip
Revise sinval code to remove no-longer-used tuple TID from inval messages.
This requires adjusting the API for syscache callback functions: they now get a hash value, not a TID, to identify the target tuple. Most of them weren't paying any attention to that argument anyway, but plancache did require a small amount of fixing. Also, improve performance a trifle by avoiding sending duplicate inval messages when a heap_update isn't changing the catcache lookup columns.
Diffstat (limited to 'src/backend/utils/cache/plancache.c')
-rw-r--r--src/backend/utils/cache/plancache.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c
index 08ddfa9bcba..1410dec1e90 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -71,8 +71,8 @@ static void ScanQueryForLocks(Query *parsetree, bool acquire);
static bool ScanQueryWalker(Node *node, bool *acquire);
static bool plan_list_is_transient(List *stmt_list);
static void PlanCacheRelCallback(Datum arg, Oid relid);
-static void PlanCacheFuncCallback(Datum arg, int cacheid, ItemPointer tuplePtr);
-static void PlanCacheSysCallback(Datum arg, int cacheid, ItemPointer tuplePtr);
+static void PlanCacheFuncCallback(Datum arg, int cacheid, uint32 hashvalue);
+static void PlanCacheSysCallback(Datum arg, int cacheid, uint32 hashvalue);
/*
@@ -1029,14 +1029,14 @@ PlanCacheRelCallback(Datum arg, Oid relid)
* PlanCacheFuncCallback
* Syscache inval callback function for PROCOID cache
*
- * Invalidate all plans mentioning the given catalog entry, or all plans
- * mentioning any member of this cache if tuplePtr == NULL.
+ * Invalidate all plans mentioning the object with the specified hash value,
+ * or all plans mentioning any member of this cache if hashvalue == 0.
*
* Note that the coding would support use for multiple caches, but right
* now only user-defined functions are tracked this way.
*/
static void
-PlanCacheFuncCallback(Datum arg, int cacheid, ItemPointer tuplePtr)
+PlanCacheFuncCallback(Datum arg, int cacheid, uint32 hashvalue)
{
ListCell *lc1;
@@ -1060,8 +1060,8 @@ PlanCacheFuncCallback(Datum arg, int cacheid, ItemPointer tuplePtr)
if (item->cacheId != cacheid)
continue;
- if (tuplePtr == NULL ||
- ItemPointerEquals(tuplePtr, &item->tupleId))
+ if (hashvalue == 0 ||
+ item->hashValue == hashvalue)
{
/* Invalidate the plan! */
plan->dead = true;
@@ -1086,8 +1086,8 @@ PlanCacheFuncCallback(Datum arg, int cacheid, ItemPointer tuplePtr)
if (item->cacheId != cacheid)
continue;
- if (tuplePtr == NULL ||
- ItemPointerEquals(tuplePtr, &item->tupleId))
+ if (hashvalue == 0 ||
+ item->hashValue == hashvalue)
{
/* Invalidate the plan! */
plan->dead = true;
@@ -1108,7 +1108,7 @@ PlanCacheFuncCallback(Datum arg, int cacheid, ItemPointer tuplePtr)
* Just invalidate everything...
*/
static void
-PlanCacheSysCallback(Datum arg, int cacheid, ItemPointer tuplePtr)
+PlanCacheSysCallback(Datum arg, int cacheid, uint32 hashvalue)
{
ResetPlanCache();
}