diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-08 19:17:23 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-08 19:17:23 +0000 |
commit | 4568e0f791f7e838409e1ef93d3513a6314b835e (patch) | |
tree | f35fc0900e984a6ec9fe0861753330df613ed41c /src/backend/access/transam/xact.c | |
parent | be27a2012311af1ad3254b2d17df28f7f4ddd5c5 (diff) |
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.
Diffstat (limited to 'src/backend/access/transam/xact.c')
-rw-r--r-- | src/backend/access/transam/xact.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index ee33030292f..5323cefe0e7 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -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); |