Thread
Commits
-
Generate pgstat_count_slru*() functions for slru using macros
- eccba079c2ea 19 (unreleased) landed
-
Generate pgstat_count_slru*() functions for slru using macros
Bertrand Drouvot <bertranddrouvot.pg@gmail.com> — 2025-08-29T15:02:23Z
Hi hackers, I was looking at pgstat_slru.c (I've in mind to provide some of those metrics per backend), and realized that the same code pattern is repeated 7 times. PFA a patch to $SUBJECT, removing a few lines of originally-duplicated code patterns. In passing, some functions have to be renamed to match their associated counter. This is the same idea as 850f4b4, 8018ffb or 83a1a1b. Looking forward to your feedback, Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
-
Re: Generate pgstat_count_slru*() functions for slru using macros
Michael Paquier <michael@paquier.xyz> — 2025-09-01T01:53:41Z
On Fri, Aug 29, 2025 at 03:02:23PM +0000, Bertrand Drouvot wrote: > I was looking at pgstat_slru.c (I've in mind to provide some of those metrics > per backend), and realized that the same code pattern is repeated 7 times. So, the gist of the change is centralized around get_slru_entry(), renaming the routines to match with the field names. It's a bit puzzling that we used different names for the fields and the routines, with "blocks" vs "page". > PFA a patch to $SUBJECT, removing a few lines of originally-duplicated > code patterns. In passing, some functions have to be renamed to match their > associated counter. It does not hurt, so fine by me on consistency grounds. > This is the same idea as 850f4b4, 8018ffb or 83a1a1b. That rings a bell. I'm OK with your proposal here, cutting some code. Let's wait a bit to see if others have any comments. -- Michael