]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
bufmgr: Fix use of wrong variable in GetPrivateRefCountEntrySlow()
authorAndres Freund <andres@anarazel.de>
Wed, 11 Mar 2026 21:26:38 +0000 (17:26 -0400)
committerAndres Freund <andres@anarazel.de>
Wed, 11 Mar 2026 21:52:21 +0000 (17:52 -0400)
Unfortunately, in 30df61990c67, I made GetPrivateRefCountEntrySlow() set a
wrong cache hint when moving entries from the hash table to the faster array.
There are no correctness concerns due to this, just an unnecessary loss of
performance.

Noticed while testing the index prefetching patch.

Discussion: https://postgr.es/m/CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com

src/backend/storage/buffer/bufmgr.c

index 6ded968e16385bb6e169f1472a1c77d9932ed477..027a59a68ca7f4f25b6cdeeb925356fca0825611 100644 (file)
@@ -469,7 +469,7 @@ GetPrivateRefCountEntrySlow(Buffer buffer, bool do_move)
                free->data = res->data;
                PrivateRefCountArrayKeys[ReservedRefCountSlot] = buffer;
                /* update cache for the next lookup */
-               PrivateRefCountEntryLast = match;
+               PrivateRefCountEntryLast = ReservedRefCountSlot;
 
                ReservedRefCountSlot = -1;