Skip to content

Commit dc1b8ce

Browse files
committed
Fix plancache's invalidation callback to do the right thing for a SI
reset event, namely invalidate everything. This oversight probably explains the rare failures that some buildfarm machines have been showing for the plancache regression test.
1 parent 1cc97d1 commit dc1b8ce

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/backend/utils/cache/plancache.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* Portions Copyright (c) 1994, Regents of the University of California
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.4 2007/03/23 19:53:51 tgl Exp $
36+
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.5 2007/03/26 00:36:19 tgl Exp $
3737
*
3838
*-------------------------------------------------------------------------
3939
*/
@@ -812,6 +812,9 @@ PlanCacheComputeResultDesc(List *stmt_list)
812812
/*
813813
* PlanCacheCallback
814814
* Relcache inval callback function
815+
*
816+
* Invalidate all plans mentioning the given rel, or all plans mentioning
817+
* any rel at all if relid == InvalidOid.
815818
*/
816819
static void
817820
PlanCacheCallback(Datum arg, Oid relid)
@@ -843,7 +846,7 @@ PlanCacheCallback(Datum arg, Oid relid)
843846

844847
if (rte->rtekind != RTE_RELATION)
845848
continue;
846-
if (relid == rte->relid)
849+
if (relid == rte->relid || relid == InvalidOid)
847850
{
848851
/* Invalidate the plan! */
849852
plan->dead = true;
@@ -883,10 +886,11 @@ PlanCacheCallback(Datum arg, Oid relid)
883886
static void
884887
InvalRelid(Oid relid, LOCKMODE lockmode, InvalRelidContext *context)
885888
{
886-
if (relid == context->inval_relid)
889+
if (relid == context->inval_relid || context->inval_relid == InvalidOid)
887890
context->plan->dead = true;
888891
}
889892

893+
890894
/*
891895
* HaveCachedPlans
892896
* Check if the plancache has stored any plans at all.
@@ -896,4 +900,3 @@ HaveCachedPlans(void)
896900
{
897901
return (cached_plans_list != NIL);
898902
}
899-

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy