Re: Make pg_stat_io view count IOs as bytes instead of blocks

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Make pg_stat_io view count IOs as bytes instead of blocks
Date: 2024-12-26 11:41:26
Message-ID: CAN55FZ3YH3iYPedec23mf+0W5C0XPxuj0rFKEirmnFuuiPcPnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, 24 Dec 2024 at 09:13, Michael Paquier <michael(at)paquier(dot)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

Attachment Content-Type Size
v4-0001-Make-pg_stat_io-count-IOs-as-bytes-instead-of-blo.patch text/x-patch 23.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2024-12-26 12:00:37 Re: Memory leak in pg_logical_slot_{get,peek}_changes
Previous Message Yura Sokolov 2024-12-26 10:10:59 Bug in v13 due to "Fix corruption when relation truncation fails."