]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Search for SLRU page only in its own bank
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Aug 2024 00:49:57 +0000 (20:49 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Aug 2024 00:49:57 +0000 (20:49 -0400)
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

src/backend/access/transam/slru.c

index 248aa1a6553b6106013b4f4391e65a9914900d5b..27473009b002867e8cd0000f6e5b61143ee97b6f 100644 (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)