]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix harmless leftover in _hash_kill_items()
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 7 Apr 2026 14:38:11 +0000 (17:38 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 7 Apr 2026 14:38:11 +0000 (17:38 +0300)
Checking for 'havePin' is sufficient here. An earlier version of the
patch didn't have the 'havePin' variable and used
'so->hashso_bucket_buf == so->currPos.buf' as the condition when both
locking and unlocking the page. The havePin variable was added later
during development, but the unlocking condition wasn't fully
updated. Tidy it up.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/b9de8d05-3b02-4a27-9b0b-03972fa4bfd3@iki.fi

src/backend/access/hash/hashutil.c

index 081adbc88a602e5fe60cb97555780c8101e1f317..1d1b05f876ad30095442ac05895b7e485f991ede 100644 (file)
@@ -625,8 +625,7 @@ _hash_kill_items(IndexScanDesc scan)
        }
 
 unlock_page:
-       if (so->hashso_bucket_buf == so->currPos.buf ||
-               havePin)
+       if (havePin)
                LockBuffer(so->currPos.buf, BUFFER_LOCK_UNLOCK);
        else
                _hash_relbuf(rel, buf);