1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

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

Commit a07e03fd8f 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
This commit is contained in:
Noah Misch
2024-10-29 09:39:55 -07:00
parent 502e7bf7f0
commit 30d47ec8c6
3 changed files with 14 additions and 11 deletions

View File

@ -338,7 +338,8 @@ extern TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple,
Buffer *buffer, struct TM_FailureData *tmfd);
extern bool heap_inplace_lock(Relation relation,
HeapTuple oldtup_ptr, Buffer buffer);
HeapTuple oldtup_ptr, Buffer buffer,
void (*release_callback) (void *), void *arg);
extern void heap_inplace_update_and_unlock(Relation relation,
HeapTuple oldtup, HeapTuple tuple,
Buffer buffer);