Unpin buffer before inplace update waits for an XID to end.

Noah Misch <noah@leadboat.com>

Commit: 11e3f288f3dbda8b460aba93e1c18b55017e7b08
Author: Noah Misch <noah@leadboat.com>
Date: 2024-10-29T16:39:59Z
Releases: 14.14
Unpin buffer before inplace update waits for an XID to end.

Commit a07e03fd8fa7daf4d1356f7cb501ffe784ea6257 changed inplace updates
to wait for heap_update() commands like GRANT TABLE and GRANT DATABASE.
By keeping the pin during that wait, a sequence of autovacuum workers
and an uncommitted GRANT starved one foreground LockBufferForCleanup()
for six minutes, on buildfarm member sarus.  Prevent, at the cost of a
bit of complexity.  Back-patch to v12, like the earlier commit.  That
commit and heap_inplace_lock() have not yet appeared in any release.

Discussion: https://postgr.es/m/20241026184936.ae.nmisch@google.com

Files

PathChange+/−
src/backend/access/heap/heapam.c modified +7 −3
src/backend/access/index/genam.c modified +5 −7
src/include/access/heapam.h modified +2 −1

Discussion