Fix hash bucket split buffer pin leak.

The process by which a hash index inserter finishes an incomplete bucket
split involves a walk of the new bucket (the bucket "being populated")
to collect the TIDs that the interrupted split already moved.  This
process keeps a pin on the new bucket's primary page, and then takes
conditional cleanup locks on both buckets.  When either lock could not
be acquired, we gave up, but neglected to release the new bucket's pin.

To fix, release the buffer pin on failure.

Oversight in commit 6d46f4783, which improved hash index bucket split
behavior by switching it from using a heavyweight lock to using these
cleanup locks.

Author: Peter Geoghegan <[email protected]>
Reviewed-by: Ayush Tiwari <[email protected]>
Discussion: 
https://postgr.es/m/CAH2-Wz=b9ssbv15hsgzauazjju8-yrghopljvp+djgedabx...@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e61e120c104d2fe06ee63d4704cb6d2429bccf3d

Modified Files
--------------
src/backend/access/hash/hashpage.c | 2 ++
1 file changed, 2 insertions(+)

Reply via email to