diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-06-19 19:42:16 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-06-19 19:42:16 +0000 |
commit | bbbc00af8829ea442ea9b8a43bdf751f0568bc92 (patch) | |
tree | ebe363134eeabf96e4086147b87d039886bd903b /src/backend/access/transam/xact.c | |
parent | d9a069e2242b360351df39687a956bf278607b7a (diff) | |
download | postgresql-bbbc00af8829ea442ea9b8a43bdf751f0568bc92.tar.gz postgresql-bbbc00af8829ea442ea9b8a43bdf751f0568bc92.zip |
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.
Diffstat (limited to 'src/backend/access/transam/xact.c')
-rw-r--r-- | src/backend/access/transam/xact.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 4e13d689f1f..9e048deba6b 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.102 2001/05/04 18:39:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.103 2001/06/19 19:42:15 tgl Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -544,7 +544,6 @@ CommandCounterIncrement(void) */ AtCommit_LocalCache(); AtStart_Cache(); - } void @@ -577,7 +576,7 @@ InitializeTransactionSystem(void) static void AtStart_Cache(void) { - DiscardInvalid(); + AcceptInvalidationMessages(); } /* -------------------------------- @@ -725,11 +724,10 @@ RecordTransactionCommit() static void AtCommit_Cache(void) { - /* - * Make catalog changes visible to all backend. + * Make catalog changes visible to all backends. */ - RegisterInvalid(true); + AtEOXactInvalidationMessages(true); } /* -------------------------------- @@ -739,11 +737,10 @@ AtCommit_Cache(void) static void AtCommit_LocalCache(void) { - /* * Make catalog changes visible to me for the next command. */ - ImmediateLocalInvalidation(true); + CommandEndInvalidationMessages(true); } /* -------------------------------- @@ -753,7 +750,6 @@ AtCommit_LocalCache(void) static void AtCommit_Locks(void) { - /* * XXX What if ProcReleaseLocks fails? (race condition?) * @@ -769,7 +765,6 @@ AtCommit_Locks(void) static void AtCommit_Memory(void) { - /* * Now that we're "out" of a transaction, have the system allocate * things in the top memory context instead of per-transaction @@ -844,7 +839,7 @@ static void AtAbort_Cache(void) { RelationCacheAbort(); - RegisterInvalid(false); + AtEOXactInvalidationMessages(false); } /* -------------------------------- |