pgsql: Allow IO time to be counted without a matching IO operation in p

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow IO time to be counted without a matching IO operation in p
Date: 2026-07-31 21:48:49
Message-ID: E1wpv61-000000019FU-33Gd@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow IO time to be counted without a matching IO operation in pg_stat_io

Since 999dec9ec6a816680, pg_stat_io can show read time with zero reads
for an IO Context: a foreign IO is counted as a read only in the
initiating backend, while other waiters record only the wait time. That
violates pgstat_bktype_io_stats_valid(). Relax the check to allow time
without a matching operation count, since we want to count read wait
time even in backends that did not initiate the read. This also enables
future accounting of waits on IO resources (e.g., AIO handles) in
backends that didn't start the IO.

Author: Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>
Reported-by: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Reviewed-by: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Discussion: https://postgr.es/m/ak5lccE4qiQpOBHn@pryzbyj2023
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

Modified Files
--------------
doc/src/sgml/monitoring.sgml | 4 +++-
src/backend/storage/buffer/bufmgr.c | 8 ++++----
src/backend/utils/activity/pgstat_io.c | 22 +++++++---------------
3 files changed, 14 insertions(+), 20 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-08-01 10:45:21 pgsql: pg_verifybackup: Improve some error handling around strtoul() ca
Previous Message Melanie Plageman 2026-07-31 21:47:18 pgsql: Allow IO time to be counted without a matching IO operation in p