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

Commit9cf6033

Browse files
committed
Revert unintentional change in increasing usage count during pin of buffers,
this makes buffer access strategy have no effect.Change was a part of commit4835458 during 9.6release cycle, so backpath to 9.6Reported-by: Jim NasbyAuthor: Alexander KorotkovReviewed-by: Jim Nasby, Andres Freundhttps://commitfest.postgresql.org/13/1029/
1 parentde34123 commit9cf6033

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,9 +1595,21 @@ PinBuffer(BufferDesc *buf, BufferAccessStrategy strategy)
15951595
/* increase refcount */
15961596
buf_state+=BUF_REFCOUNT_ONE;
15971597

1598-
/* increase usagecount unless already max */
1599-
if (BUF_STATE_GET_USAGECOUNT(buf_state)!=BM_MAX_USAGE_COUNT)
1600-
buf_state+=BUF_USAGECOUNT_ONE;
1598+
if (strategy==NULL)
1599+
{
1600+
/* Default case: increase usagecount unless already max. */
1601+
if (BUF_STATE_GET_USAGECOUNT(buf_state)<BM_MAX_USAGE_COUNT)
1602+
buf_state+=BUF_USAGECOUNT_ONE;
1603+
}
1604+
else
1605+
{
1606+
/*
1607+
* Ring buffers shouldn't evict others from pool. Thus we
1608+
* don't make usagecount more than 1.
1609+
*/
1610+
if (BUF_STATE_GET_USAGECOUNT(buf_state)==0)
1611+
buf_state+=BUF_USAGECOUNT_ONE;
1612+
}
16011613

16021614
if (pg_atomic_compare_exchange_u32(&buf->state,&old_buf_state,
16031615
buf_state))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp