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

Commit15269b5

Browse files
committed
Avoid useless loop overhead in AtEOXact routines when the backend is
compiled with USE_ASSERT_CHECKING but is running with assert_enabled false.
1 parent4568e0f commit15269b5

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.191 2005/08/0803:11:44 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.192 2005/08/0819:44:22 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1067,15 +1067,18 @@ void
10671067
AtEOXact_Buffers(boolisCommit)
10681068
{
10691069
#ifdefUSE_ASSERT_CHECKING
1070-
inti;
1071-
1072-
for (i=0;i<NBuffers;i++)
1070+
if (assert_enabled)
10731071
{
1074-
Assert(PrivateRefCount[i]==0);
1072+
inti;
1073+
1074+
for (i=0;i<NBuffers;i++)
1075+
{
1076+
Assert(PrivateRefCount[i]==0);
1077+
}
10751078
}
1079+
#endif
10761080

10771081
AtEOXact_LocalBuffers(isCommit);
1078-
#endif
10791082

10801083
/* Make sure we reset the strategy hint in case VACUUM errored out */
10811084
StrategyHintVacuum(false);

‎src/backend/storage/buffer/localbuf.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.67 2005/05/29 04:23:04 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.68 2005/08/08 19:44:22 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -308,11 +308,14 @@ void
308308
AtEOXact_LocalBuffers(boolisCommit)
309309
{
310310
#ifdefUSE_ASSERT_CHECKING
311-
inti;
312-
313-
for (i=0;i<NLocBuffer;i++)
311+
if (assert_enabled)
314312
{
315-
Assert(LocalRefCount[i]==0);
313+
inti;
314+
315+
for (i=0;i<NLocBuffer;i++)
316+
{
317+
Assert(LocalRefCount[i]==0);
318+
}
316319
}
317320
#endif
318321
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp