Re: BUG #19953: pg_stat_io exposes impossible rows for io worker backends

From: Pavan <prampalli30(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: idrissaajalloh(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19953: pg_stat_io exposes impossible rows for io worker backends
Date: 2026-12-02 15:49:33
Message-ID: CAEyqiQGhB2hh5dzev9Y6W1RF5b94fo1eRPom9ikXbDCH7Fc=4A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Michael,

Here is a patch for this.

pgstat_tracks_io_bktype() currently returns true for B_IO_WORKER,
causing pg_stat_io to expose 8 rows for backend_type = 'io worker'
(including temp relation and WAL). Since AIO statistics are charged
to the submitting backend rather than the IO worker (IoWorkerMain()
does not record pg_stat_io counters, and pgstat_tracks_backend_bktype()
already returns false for B_IO_WORKER), these rows can never accumulate
non-zero counts.

The attached patch moves B_IO_WORKER to the return-false branch in
pgstat_tracks_io_bktype(), updates the header comment to match, and
removes the 8 io worker rows from expected/stats.out.

Tested on master (026b3b2) with --enable-cassert --enable-debug:
- All 243 tests in `make check` pass.
- Verified live with io_method = worker (2 active io workers) under a
disk-reading workload, VACUUM, temp table, and CHECKPOINT:
pg_stat_io returns 0 rows for 'io worker', AIO counters continue to
accumulate on 'client backend', and pg_stat_get_backend_io() returns
0 rows for io worker PIDs.

Regards,
Pavan

Attachment Content-Type Size
v1-0001-Exclude-B_IO_WORKER-from-pg_stat_io.patch application/octet-stream 3.1 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Tom Lane 2026-12-02 15:45:18 Re: BUG #19969: Result inconsistency with scale() over an INTERSECT subquery