]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Move I/O before the index_update_stats() buffer lock region.
authorNoah Misch <noah@leadboat.com>
Sat, 2 Nov 2024 16:04:55 +0000 (09:04 -0700)
committerNoah Misch <noah@leadboat.com>
Sat, 2 Nov 2024 16:05:02 +0000 (09:05 -0700)
commit6c837c237bf821ee78522259c847f417d1e11fd7
treebe55697d935b90e452090457087a312b1240f790
parent6f9dd2282e37589bdadf15423b0395ce11735f82
Move I/O before the index_update_stats() buffer lock region.

Commit a07e03fd8fa7daf4d1356f7cb501ffe784ea6257 enlarged the work done
here under the pg_class heap buffer lock.  Two preexisting actions are
best done before holding that lock.  Both RelationGetNumberOfBlocks()
and visibilitymap_count() do I/O, and the latter might exclusive-lock a
visibility map buffer.  Moving these reduces contention and risk of
undetected LWLock deadlock.  Back-patch to v12, like that commit.

Discussion: https://postgr.es/m/20241031200139.b4@rfd.leadboat.com
src/backend/catalog/index.c