Thread: Add regression test checking combinations of (object,backend_type,context) in pg_stat_io
Add regression test checking combinations of (object,backend_type,context) in pg_stat_io
From
Michael Paquier
Date:
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? -- Michael
Attachment
Re: Add regression test checking combinations of (object,backend_type,context) in pg_stat_io
From
Bertrand Drouvot
Date:
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
Re: Add regression test checking combinations of (object,backend_type,context) in pg_stat_io
From
Michael Paquier
Date:
On Wed, Mar 05, 2025 at 07:34:16AM +0000, Bertrand Drouvot wrote: > 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. Thanks for the review. > What about adding some extra paranoia like? > > SELECT backend_type, object, context FROM pg_stat_io ORDER BY > backend_type, object, context COLLATE "C"; Why not, to force the ordering. -- Michael