mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
Modify AtEOXact_CatCache and AtEOXact_RelationCache to assume that the
ResourceOwner mechanism already released all reference counts for the cache entries; therefore, we do not need to scan the catcache or relcache at transaction end, unless we want to do it as a debugging crosscheck. Do the crosscheck only in Assert mode. This is the same logic we had previously installed in AtEOXact_Buffers to avoid overhead with large numbers of shared buffers. I thought it'd be a good idea to do it here too, in view of Kari Lavikka's recent report showing a real-world case where AtEOXact_CatCache is taking a significant fraction of runtime.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.211 2005/07/25 22:12:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.212 2005/08/08 19:17:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1549,6 +1549,9 @@ CommitTransaction(void)
|
||||
/* Check we've released all buffer pins */
|
||||
AtEOXact_Buffers(true);
|
||||
|
||||
/* Clean up the relation cache */
|
||||
AtEOXact_RelationCache(true);
|
||||
|
||||
/*
|
||||
* Make catalog changes visible to all backends. This has to happen
|
||||
* after relcache references are dropped (see comments for
|
||||
@ -1576,6 +1579,9 @@ CommitTransaction(void)
|
||||
RESOURCE_RELEASE_AFTER_LOCKS,
|
||||
true, true);
|
||||
|
||||
/* Check we've released all catcache entries */
|
||||
AtEOXact_CatCache(true);
|
||||
|
||||
AtEOXact_GUC(true, false);
|
||||
AtEOXact_SPI(true);
|
||||
AtEOXact_on_commit_actions(true);
|
||||
@ -1768,6 +1774,9 @@ PrepareTransaction(void)
|
||||
/* Check we've released all buffer pins */
|
||||
AtEOXact_Buffers(true);
|
||||
|
||||
/* Clean up the relation cache */
|
||||
AtEOXact_RelationCache(true);
|
||||
|
||||
/* notify and flatfiles don't need a postprepare call */
|
||||
|
||||
PostPrepare_Inval();
|
||||
@ -1785,6 +1794,9 @@ PrepareTransaction(void)
|
||||
RESOURCE_RELEASE_AFTER_LOCKS,
|
||||
true, true);
|
||||
|
||||
/* Check we've released all catcache entries */
|
||||
AtEOXact_CatCache(true);
|
||||
|
||||
/* PREPARE acts the same as COMMIT as far as GUC is concerned */
|
||||
AtEOXact_GUC(true, false);
|
||||
AtEOXact_SPI(true);
|
||||
@ -1922,6 +1934,7 @@ AbortTransaction(void)
|
||||
RESOURCE_RELEASE_BEFORE_LOCKS,
|
||||
false, true);
|
||||
AtEOXact_Buffers(false);
|
||||
AtEOXact_RelationCache(false);
|
||||
AtEOXact_Inval(false);
|
||||
smgrDoPendingDeletes(false);
|
||||
AtEOXact_MultiXact();
|
||||
@ -1931,6 +1944,7 @@ AbortTransaction(void)
|
||||
ResourceOwnerRelease(TopTransactionResourceOwner,
|
||||
RESOURCE_RELEASE_AFTER_LOCKS,
|
||||
false, true);
|
||||
AtEOXact_CatCache(false);
|
||||
|
||||
AtEOXact_GUC(false, false);
|
||||
AtEOXact_SPI(false);
|
||||
|
Reference in New Issue
Block a user