1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-29 16:21:20 +03:00

Search for SLRU page only in its own bank

One of the two slot scans in SlruSelectLRUPage was not walking only the
slots in the specific bank where the buffer could be; change it to do
that.

Oversight in 53c2a97a9266.

Author: Sergey Sargsyan <sergey.sargsyan.2001@gmail.com>
Discussion: https://postgr.es/m/18582-5f301dd30ba91a38@postgresql.org
This commit is contained in:
Alvaro Herrera 2024-08-18 20:49:57 -04:00
parent 4b6aa0cffc
commit fad0da271e
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE

View File

@ -1184,7 +1184,7 @@ SlruSelectLRUPage(SlruCtl ctl, int64 pageno)
Assert(LWLockHeldByMe(SimpleLruGetBankLock(ctl, pageno)));
/* See if page already has a buffer assigned */
for (int slotno = 0; slotno < shared->num_slots; slotno++)
for (int slotno = bankstart; slotno < bankend; slotno++)
{
if (shared->page_status[slotno] != SLRU_PAGE_EMPTY &&
shared->page_number[slotno] == pageno)