Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4568e0f

Browse files
committed
Modify AtEOXact_CatCache and AtEOXact_RelationCache to assume that the
ResourceOwner mechanism already released all reference counts for thecache entries; therefore, we do not need to scan the catcache or relcacheat 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 hadpreviously installed in AtEOXact_Buffers to avoid overhead with largenumbers of shared buffers. I thought it'd be a good idea to do it heretoo, in view of Kari Lavikka's recent report showing a real-world casewhere AtEOXact_CatCache is taking a significant fraction of runtime.
1 parentbe27a20 commit4568e0f

File tree

4 files changed

+233
-236
lines changed

4 files changed

+233
-236
lines changed

‎src/backend/access/transam/xact.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.211 2005/07/25 22:12:31 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.212 2005/08/08 19:17:22 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1549,6 +1549,9 @@ CommitTransaction(void)
15491549
/* Check we've released all buffer pins */
15501550
AtEOXact_Buffers(true);
15511551

1552+
/* Clean up the relation cache */
1553+
AtEOXact_RelationCache(true);
1554+
15521555
/*
15531556
* Make catalog changes visible to all backends. This has to happen
15541557
* after relcache references are dropped (see comments for
@@ -1576,6 +1579,9 @@ CommitTransaction(void)
15761579
RESOURCE_RELEASE_AFTER_LOCKS,
15771580
true, true);
15781581

1582+
/* Check we've released all catcache entries */
1583+
AtEOXact_CatCache(true);
1584+
15791585
AtEOXact_GUC(true, false);
15801586
AtEOXact_SPI(true);
15811587
AtEOXact_on_commit_actions(true);
@@ -1768,6 +1774,9 @@ PrepareTransaction(void)
17681774
/* Check we've released all buffer pins */
17691775
AtEOXact_Buffers(true);
17701776

1777+
/* Clean up the relation cache */
1778+
AtEOXact_RelationCache(true);
1779+
17711780
/* notify and flatfiles don't need a postprepare call */
17721781

17731782
PostPrepare_Inval();
@@ -1785,6 +1794,9 @@ PrepareTransaction(void)
17851794
RESOURCE_RELEASE_AFTER_LOCKS,
17861795
true, true);
17871796

1797+
/* Check we've released all catcache entries */
1798+
AtEOXact_CatCache(true);
1799+
17881800
/* PREPARE acts the same as COMMIT as far as GUC is concerned */
17891801
AtEOXact_GUC(true, false);
17901802
AtEOXact_SPI(true);
@@ -1922,6 +1934,7 @@ AbortTransaction(void)
19221934
RESOURCE_RELEASE_BEFORE_LOCKS,
19231935
false, true);
19241936
AtEOXact_Buffers(false);
1937+
AtEOXact_RelationCache(false);
19251938
AtEOXact_Inval(false);
19261939
smgrDoPendingDeletes(false);
19271940
AtEOXact_MultiXact();
@@ -1931,6 +1944,7 @@ AbortTransaction(void)
19311944
ResourceOwnerRelease(TopTransactionResourceOwner,
19321945
RESOURCE_RELEASE_AFTER_LOCKS,
19331946
false, true);
1947+
AtEOXact_CatCache(false);
19341948

19351949
AtEOXact_GUC(false, false);
19361950
AtEOXact_SPI(false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp