]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Allow IO time to be counted without a matching IO operation in pg_stat_io master github/master
authorMelanie Plageman <melanieplageman@gmail.com>
Fri, 31 Jul 2026 21:45:45 +0000 (17:45 -0400)
committerMelanie Plageman <melanieplageman@gmail.com>
Fri, 31 Jul 2026 21:46:36 +0000 (17:46 -0400)
commitc9a669492719db2fe45cd17259ae0fc3bc4d91c5
tree0f10f1bbccfb0259ea4b37a367f53c10eea5ddfd
parent481052c7754013d44a89f50912ba6845398f88df
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@gmail.com>
Reported-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/ak5lccE4qiQpOBHn@pryzbyj2023
Backpatch-through: 19
doc/src/sgml/monitoring.sgml
src/backend/storage/buffer/bufmgr.c
src/backend/utils/activity/pgstat_io.c