agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix pgstat_count_io_op_time() calls passing incorrect informatio
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix pgstat_count_io_op_time() calls passing incorrect informatio
@ 2026-06-17 07:10 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-06-17 07:10 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pgstat_count_io_op_time() calls passing incorrect information

Several calls of pgstat_count_io_op_time() have been used as data to
count negative values returned by pg_pread() or pg_pwrite(), leading to
an incorrect count reported, casting them back to uint64.

Most of the problematic calls updated here are adjusted so as we do not
report buggy negative numbers anymore.  In xlogrecovery.c, the spot
updated still counts short reads.  In xlog.c, after a WAL segment
initialization, I/O numbers are aggregated only after checking that the
operation has succeeded.

issues introduced by a051e71e28a1.

Reported-by: Peter Eisentraut <peter@eisentraut.org>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/0db864e6-4477-4eba-b2be-d3523cc86564@eisentraut.org
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3048e81308f9d0ebe62214b56c8ea3da42e45851

Modified Files
--------------
src/backend/access/transam/xlog.c         | 22 +++++++++++-----------
src/backend/access/transam/xlogreader.c   |  8 +++++---
src/backend/access/transam/xlogrecovery.c |  6 ++++--
src/backend/replication/walreceiver.c     |  6 +++---
4 files changed, 23 insertions(+), 19 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix pgstat_count_io_op_time() calls passing incorrect informatio
@ 2026-06-17 07:10 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-06-17 07:10 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pgstat_count_io_op_time() calls passing incorrect information

Several calls of pgstat_count_io_op_time() have been used as data to
count negative values returned by pg_pread() or pg_pwrite(), leading to
an incorrect count reported, casting them back to uint64.

Most of the problematic calls updated here are adjusted so as we do not
report buggy negative numbers anymore.  In xlogrecovery.c, the spot
updated still counts short reads.  In xlog.c, after a WAL segment
initialization, I/O numbers are aggregated only after checking that the
operation has succeeded.

issues introduced by a051e71e28a1.

Reported-by: Peter Eisentraut <peter@eisentraut.org>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/0db864e6-4477-4eba-b2be-d3523cc86564@eisentraut.org
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/13f940b4b56f38414a0dbd820f65c8e74f55d466

Modified Files
--------------
src/backend/access/transam/xlog.c         | 22 +++++++++++-----------
src/backend/access/transam/xlogreader.c   |  8 +++++---
src/backend/access/transam/xlogrecovery.c |  6 ++++--
src/backend/replication/walreceiver.c     |  6 +++---
4 files changed, 23 insertions(+), 19 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-06-17 07:10 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-17 07:10 pgsql: Fix pgstat_count_io_op_time() calls passing incorrect informatio Michael Paquier <michael@paquier.xyz>
2026-06-17 07:10 pgsql: Fix pgstat_count_io_op_time() calls passing incorrect informatio Michael Paquier <michael@paquier.xyz>

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