Commit fc299179 authored by Tom Lane's avatar Tom Lane

Separate the functions of relcache entry flush and smgr cache entry flush

so that we can get the size of a shared inval message back down to what it
was in 7.4 (and simplify the logic too).  Phase 2 of fixing the
'SMgrRelation hashtable corrupted' problem.
parent 0ce4d569
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/storage/sinval.h,v 1.39 2004/12/31 22:03:42 pgsql Exp $ * $PostgreSQL: pgsql/src/include/storage/sinval.h,v 1.40 2005/01/10 21:57:19 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -20,22 +20,16 @@ ...@@ -20,22 +20,16 @@
/* /*
* We currently support two types of shared-invalidation messages: one that * We currently support three types of shared-invalidation messages: one that
* invalidates an entry in a catcache, and one that invalidates a relcache * invalidates an entry in a catcache, one that invalidates a relcache entry,
* entry. More types could be added if needed. The message type is * and one that invalidates an smgr cache entry. More types could be added
* identified by the first "int16" field of the message struct. Zero or * if needed. The message type is identified by the first "int16" field of
* positive means a catcache inval message (and also serves as the catcache * the message struct. Zero or positive means a catcache inval message (and
* ID field). -1 means a relcache inval message. Other negative values * also serves as the catcache ID field). -1 means a relcache inval message.
* are available to identify other inval message types. * -2 means an smgr inval message. Other negative values are available to
* identify other inval message types.
* *
* Relcache invalidation messages usually also cause invalidation of entries * Catcache inval events are initially driven by detecting tuple inserts,
* in the smgr's relation cache. This means they must carry both logical
* and physical relation ID info (ie, both dbOID/relOID and RelFileNode).
* In some cases RelFileNode information is not available so the sender fills
* those fields with zeroes --- this is okay so long as no smgr cache flush
* is required.
*
* Shared-inval events are initially driven by detecting tuple inserts,
* updates and deletions in system catalogs (see CacheInvalidateHeapTuple). * updates and deletions in system catalogs (see CacheInvalidateHeapTuple).
* An update generates two inval events, one for the old tuple and one for * An update generates two inval events, one for the old tuple and one for
* the new --- this is needed to get rid of both positive entries for the * the new --- this is needed to get rid of both positive entries for the
...@@ -71,20 +65,22 @@ typedef struct ...@@ -71,20 +65,22 @@ typedef struct
int16 id; /* type field --- must be first */ int16 id; /* type field --- must be first */
Oid dbId; /* database ID, or 0 if a shared relation */ Oid dbId; /* database ID, or 0 if a shared relation */
Oid relId; /* relation ID */ Oid relId; /* relation ID */
RelFileNode physId; /* physical file ID */
/*
* Note: it is likely that RelFileNode will someday be changed to
* include database ID. In that case the dbId field will be redundant
* and should be removed to save space.
*/
} SharedInvalRelcacheMsg; } SharedInvalRelcacheMsg;
#define SHAREDINVALSMGR_ID (-2)
typedef struct
{
int16 id; /* type field --- must be first */
RelFileNode rnode; /* physical file ID */
} SharedInvalSmgrMsg;
typedef union typedef union
{ {
int16 id; /* type field --- must be first */ int16 id; /* type field --- must be first */
SharedInvalCatcacheMsg cc; SharedInvalCatcacheMsg cc;
SharedInvalRelcacheMsg rc; SharedInvalRelcacheMsg rc;
SharedInvalSmgrMsg sm;
} SharedInvalidationMessage; } SharedInvalidationMessage;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment