Re: Fix bank selection logic in SLRU - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: Fix bank selection logic in SLRU
Date
Msg-id CAFiTN-u9Ba8Wve6ed2n80cnmVYWGM=yirM03F5t0e5gSrHgEYg@mail.gmail.com
Whole thread Raw
In response to Re: Fix bank selection logic in SLRU  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Tue, 10 Dec 2024 at 7:30 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Tue, Dec 10, 2024 at 8:58 AM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>> Bank selection code assumes that number of buffers is power of 2.
>> If the number of buffers is not power of 2 - only subset of buffers will be used. In worst case, e.g. 65 buffers, everything will be buffered only in bank 64.
>
> But why that would be the case? the acceptable values for GUC to configure the slru buffers are in multiple of 16(bank size) we have that check to check the GUC values.

"Must be a multiple of 16" and "must be a power of 2" are different
criteria. For example, 48 is a multiple of 16 but it is not a power of
2. If the code assumes that we have an actual power of 2, the check
you quoted in your previous email is insufficient.

Yeah I see it’s an issue.  Thanks for clarifying.

Dilip

pgsql-hackers by date:

Previous
From: Fabrice Chapuis
Date:
Subject: timeline problem when recovery
Next
From: Dilip Kumar
Date:
Subject: Re: Fix bank selection logic in SLRU