summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-03-05 17:01:26 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-03-05 17:01:26 +0000
commit649e856c33c1f91a9e1f8a0f55cc9171d241103b (patch)
tree0ee8c88ef9382f094852c8494f4f6996e4a47d59
parent91215f62411a9801c15e8b6890972cb3497002a1 (diff)
In PrepareToInvalidateCacheTuple, don't force initialization of catalog
caches that we don't actually need to touch. This saves some trivial number of cycles and avoids certain cases of deadlock when doing concurrent VACUUM FULL on system catalogs. Per report from Gavin Roy. Backpatch to 8.2. In earlier versions, CatalogCacheInitializeCache didn't lock the relation so there's no deadlock risk (though that certainly had plenty of risks of its own).
-rw-r--r--src/backend/utils/cache/catcache.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index f36384510c9..99004cfab62 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.140 2008/01/01 19:45:53 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.141 2008/03/05 17:01:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1781,13 +1781,13 @@ PrepareToInvalidateCacheTuple(Relation relation,
for (ccp = CacheHdr->ch_caches; ccp; ccp = ccp->cc_next)
{
+ if (ccp->cc_reloid != reloid)
+ continue;
+
/* Just in case cache hasn't finished initialization yet... */
if (ccp->cc_tupdesc == NULL)
CatalogCacheInitializeCache(ccp);
- if (ccp->cc_reloid != reloid)
- continue;
-
(*function) (ccp->id,
CatalogCacheComputeTupleHashValue(ccp, tuple),
&tuple->t_self,