Skip to content

Commit 9cf6033

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 commit 4835458 during 9.6 release cycle, so backpath to 9.6 Reported-by: Jim Nasby Author: Alexander Korotkov Reviewed-by: Jim Nasby, Andres Freund https://commitfest.postgresql.org/13/1029/
1 parent de34123 commit 9cf6033

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy