From bbbc00af8829ea442ea9b8a43bdf751f0568bc92 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 19 Jun 2001 19:42:16 +0000 Subject: Clean up some longstanding problems in shared-cache invalidation. SI messages now include the relevant database OID, so that operations in one database do not cause useless cache flushes in backends attached to other databases. Declare SI messages properly using a union, to eliminate the former assumption that Oid is the same size as int or Index. Rewrite the nearly-unreadable code in inval.c, and document it better. Arrange for catcache flushes at end of command/transaction to happen before relcache flushes do --- this avoids loading a new tuple into the catcache while setting up new relcache entry, only to have it be flushed again immediately. --- src/backend/storage/ipc/sinvaladt.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/backend/storage/ipc/sinvaladt.c') diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c index 63bc037bc9a..38096190091 100644 --- a/src/backend/storage/ipc/sinvaladt.c +++ b/src/backend/storage/ipc/sinvaladt.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.39 2001/06/16 22:58:15 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.40 2001/06/19 19:42:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,6 @@ #include "miscadmin.h" #include "storage/backendid.h" #include "storage/proc.h" -#include "storage/sinval.h" #include "storage/sinvaladt.h" SISeg *shmInvalBuffer; @@ -35,7 +34,6 @@ static void SISetProcStateInvalid(SISeg *segP); int SInvalShmemSize(int maxBackends) { - /* * Figure space needed. Note sizeof(SISeg) includes the first * ProcState entry. @@ -183,14 +181,13 @@ CleanupInvalidationState(int status, Datum arg) * Returns true for normal successful insertion, false if had to reset. */ bool -SIInsertDataEntry(SISeg *segP, SharedInvalidData *data) +SIInsertDataEntry(SISeg *segP, SharedInvalidationMessage *data) { int numMsgs = segP->maxMsgNum - segP->minMsgNum; /* Is the buffer full? */ if (numMsgs >= MAXNUMMESSAGES) { - /* * Don't panic just yet: slowest backend might have consumed some * messages but not yet have done SIDelExpiredDataEntries() to @@ -273,13 +270,12 @@ SISetProcStateInvalid(SISeg *segP) */ int SIGetDataEntry(SISeg *segP, int backendId, - SharedInvalidData *data) + SharedInvalidationMessage *data) { ProcState *stateP = &segP->procState[backendId - 1]; if (stateP->resetState) { - /* * Force reset. We can say we have dealt with any messages added * since the reset, as well... -- cgit v1.2.3