slru bank

Started by 席冲(宜穆)over 1 year ago4 messages
#1席冲(宜穆)
xichong.xc@alibaba-inc.com

Hello all,
This PostgreSQL version is 17beta2.
In SlruSelectLRUPage(), Why do we need to traverse all slots to find that a page already has a buffer assigned? Why not find it
from the [bankstart,bankend]?
Best regards

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: 席冲(宜穆) (#1)
Re: slru bank

On Thu, Aug 22, 2024 at 7:07 PM 席冲(宜穆) <xichong.xc@alibaba-inc.com> wrote:

In SlruSelectLRUPage(), Why do we need to traverse all slots to find that
a page already has a buffer assigned? Why not find it
from the [bankstart,bankend]?

Only the bank is searched, both of the logic loops are bounded by:

for (int slotno = bankstart; slotno < bankend; slotno++)

David J.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#2)
Re: slru bank

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Thu, Aug 22, 2024 at 7:07 PM 席冲(宜穆) <xichong.xc@alibaba-inc.com> wrote:

In SlruSelectLRUPage(), Why do we need to traverse all slots to find that
a page already has a buffer assigned? Why not find it
from the [bankstart,bankend]?

Only the bank is searched, both of the logic loops are bounded by:
for (int slotno = bankstart; slotno < bankend; slotno++)

I think the OP has rediscovered the bug already fixed in 7b063ff26.
That's post-17beta2, though.

regards, tom lane

#4David G. Johnston
david.g.johnston@gmail.com
In reply to: Tom Lane (#3)
Re: slru bank

On Thu, Aug 22, 2024 at 7:27 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Thu, Aug 22, 2024 at 7:07 PM 席冲(宜穆) <xichong.xc@alibaba-inc.com>

wrote:

In SlruSelectLRUPage(), Why do we need to traverse all slots to find

that

a page already has a buffer assigned? Why not find it
from the [bankstart,bankend]?

Only the bank is searched, both of the logic loops are bounded by:
for (int slotno = bankstart; slotno < bankend; slotno++)

I think the OP has rediscovered the bug already fixed in 7b063ff26.
That's post-17beta2, though.

Indeed. I was looking at HEAD.

David J.