pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Move I/O before the index_update_stats() buffer lock region.
Date: Sat, 02 Nov 2024 16:08:47 +0000
Message-ID: <E1t7GgC-003cWS-70@gemulon.postgresql.org> (raw)

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

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/catalog/index.c | 45 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 9 deletions(-)



view thread (11+ messages)  latest in thread

Message-ID: <E1t7GgC-003cWS-70@gemulon.postgresql.org>
Permalink:  ../E1t7GgC-003cWS-70@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1t7GgC-003cWS-70@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Move I/O before the index_update_stats() buffer lock region.
  In-Reply-To: <E1t7GgC-003cWS-70@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox