aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/inval.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-01-10 20:02:24 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-01-10 20:02:24 +0000
commit0ce4d56924982c04da226bc890033e377d1ef375 (patch)
tree7bea17dae3daf0483526989590035a52af6db8bc /src/backend/utils/cache/inval.c
parentcc7cd8774a644bfb484ee31320e85764ba68d1e3 (diff)
downloadpostgresql-0ce4d56924982c04da226bc890033e377d1ef375.tar.gz
postgresql-0ce4d56924982c04da226bc890033e377d1ef375.zip
Phase 1 of fix for 'SMgrRelation hashtable corrupted' problem. This
is the minimum required fix. I want to look next at taking advantage of it by simplifying the message semantics in the shared inval message queue, but that part can be held over for 8.1 if it turns out too ugly.
Diffstat (limited to 'src/backend/utils/cache/inval.c')
-rw-r--r--src/backend/utils/cache/inval.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 8c1c33e7845..8933030a9dd 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -80,7 +80,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.68 2004/12/31 22:01:25 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.69 2005/01/10 20:02:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -414,17 +414,9 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
}
else if (msg->id == SHAREDINVALRELCACHE_ID)
{
- /*
- * If the message includes a valid relfilenode, we must ensure
- * that smgr cache entry gets zapped. The relcache will handle
- * this if called, otherwise we must do it directly.
- */
if (msg->rc.dbId == MyDatabaseId || msg->rc.dbId == InvalidOid)
{
- if (OidIsValid(msg->rc.physId.relNode))
- RelationCacheInvalidateEntry(msg->rc.relId, &msg->rc.physId);
- else
- RelationCacheInvalidateEntry(msg->rc.relId, NULL);
+ RelationCacheInvalidateEntry(msg->rc.relId);
for (i = 0; i < cache_callback_count; i++)
{
@@ -434,12 +426,17 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg)
(*ccitem->function) (ccitem->arg, msg->rc.relId);
}
}
- else
- {
- /* might have smgr entry even if not in our database */
- if (OidIsValid(msg->rc.physId.relNode))
- smgrclosenode(msg->rc.physId);
- }
+ /*
+ * If the message includes a valid relfilenode, we must ensure
+ * the smgr cache entry gets zapped. This might not have happened
+ * above since the relcache entry might not have existed or might
+ * have been associated with a different relfilenode.
+ *
+ * XXX there is no real good reason for rnode inval to be in the
+ * same message at all. FIXME in 8.1.
+ */
+ if (OidIsValid(msg->rc.physId.relNode))
+ smgrclosenode(msg->rc.physId);
}
else
elog(FATAL, "unrecognized SI message id: %d", msg->id);