Re: Add regression test checking combinations of (object,backend_type,context) in pg_stat_io

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add regression test checking combinations of (object,backend_type,context) in pg_stat_io
Date: 2025-03-05 07:34:16
Message-ID: Z8f+ePP+15b2EmVW@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Mar 05, 2025 at 11:05:48AM +0900, Michael Paquier wrote:
> Hi all,
>
> While working on I/O statistics, I have noticed that it is not
> complicated to break the set of rows returned by pg_stat_io if one is
> not careful when updating pgstat_tracks_io_object().
>
> Attached is a patch that I've found useful as a sanity check,
> returning all the combinations supported for BackendType, IOContext
> and IOObject, so as it is easily possible to evaluate if the
> information returned is relevant.
>
> Thoughts?

That would mean changing the test each time pgstat_tracks_io_object() is
modified in such a way that the output is changed. That's a good thing as
the writer will need to double check if the new output makes sense according
to his changes. So I don't see any reason not to add this test.

+SELECT backend_type, object, context FROM pg_stat_io ORDER BY 1, 2, 3;

What about adding some extra paranoia like?

SELECT backend_type, object, context FROM pg_stat_io ORDER BY backend_type, object, context COLLATE "C";

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-03-05 08:04:44 Re: Monitoring gaps in XLogWalRcvWrite() for the WAL receiver
Previous Message Bertrand Drouvot 2025-03-05 07:17:09 Re: Add contrib/pg_logicalsnapinspect