postgres.git / summary / log / commit / refs
commit 06d9ce670be25a2d5918b6e22a79b757329f08cb
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed Mar 05 17:01:41 2008 +0000
First released in: 8.4.0, 8.2.7, 8.3.1
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).
src/backend/utils/cache/catcache.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 55b9d5baf07..a8658116283 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.134 2006/10/06 18:23:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.134.2.1 2008/03/05 17:01:41 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,
[parent: cbcc5b11a819]