Re: Make pg_stat_io view count IOs as bytes instead of blocks
Nazir Bilal Yavuz <byavuz81@gmail.com>
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Melanie Plageman <melanieplageman@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-12-26T11:41:26Z
Lists: pgsql-hackers
Attachments
- v4-0001-Make-pg_stat_io-count-IOs-as-bytes-instead-of-blo.patch (text/x-patch) patch v4-0001
Hi,
On Tue, 24 Dec 2024 at 09:13, Michael Paquier <michael@paquier.xyz> wrote:
>
> On Fri, Dec 06, 2024 at 12:41:55PM +0300, Nazir Bilal Yavuz wrote:
> > Thanks! I think 'track' is a better word in this context. I used
> > 'tracked in ...', as it sounded more correct to me (I hope it is).
>
> Splitting op_bytes into three fields sounds like a good idea. Count
> me in regarding the concept to depend less on BLCKSZ.
>
> typedef enum IOOp
> {
> + /* IOs not tracked in bytes */
> IOOP_EVICT,
> - IOOP_EXTEND,
> IOOP_FSYNC,
> IOOP_HIT,
> - IOOP_READ,
> IOOP_REUSE,
> - IOOP_WRITE,
> IOOP_WRITEBACK,
> +
> + /* IOs tracked in bytes */
> + IOOP_EXTEND,
> + IOOP_READ,
> + IOOP_WRITE,
> } IOOp;
>
> pg_stat_io_build_tuples() is now the code path taken when building the
> tuples returned by pg_stat_io, meaning that the new function called
> pg_stat_get_backend_io() is also going to need an update in its list
> of output parameters to accomodate with what you are changing here.
> Calling your new pgstat_get_io_byte_index() in the new refactored
> routine is also necessary. Sorry about that.
No problem at all, thank you for reminding me!
> Could you send a rebase, please? I can promise to review this
> thread's new patch, as that will also move the needle regarding your
> work with pg_stat_io to track WAL activity.
Thanks! v4 is attached. I quickly tested the pg_stat_get_backend_io()
function and it seems it is working.
--
Regards,
Nazir Bilal Yavuz
Microsoft
Commits
-
Rework macro pgstat_is_ioop_tracked_in_bytes()
- 7b6468cc9523 18.0 landed
-
Remove assertion in pgstat_count_io_op()
- d2181b321852 18.0 landed
-
Make pg_stat_io count IOs as bytes instead of blocks for some operations
- f92c854cf406 18.0 landed
-
Merge pgstat_count_io_op_n() and pgstat_count_io_op()
- f0bf7857befe 18.0 landed