| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> | 
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> | 
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org | 
| Subject: | Re: define pg_structiszero(addr, s, r) | 
| Date: | 2024-09-18 07:54:20 | 
| Message-ID: | ZuqHLCdZXtEsbyb/@ip-10-97-1-34.eu-west-3.compute.internal | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hi,
On Wed, Sep 18, 2024 at 03:07:15PM +0900, Michael Paquier wrote:
> On Wed, Sep 18, 2024 at 04:16:12AM +0000, Bertrand Drouvot wrote:
> > The macro is created in pgstat_internal.h as it looks like that "only" the 
> > statistics related code would benefit of it currently (could be moved to other
> > header file later on if needed).
> 
> I'm OK to add a helper macro in pgstat_internal.h as this is a pattern
> used only for some stats kinds (the other one I'm aware of is the
> allzero check for pages around bufmgr.c), cleaning up all these static
> declarations to make the memcpy() calls cheaper.  That can also be
> useful for anybody doing a custom pgstats kind, fixed or
> variable-numbered.
Thanks for looking at it!
> 
> #define pg_structiszero(addr, s, r)                                 \
> 
> Locating that at the top of pgstat_internal.h seems a bit out of order
> to me.  Perhaps it would be better to move it closer to the inline
> functions?
Makes sense, done that way in v2 attached.
> 
> Also, is this the best name to use here?  Right, this is something
> that may be quite generic.  However, if we limit its scope in the
> stats, perhaps this should be named pgstat_entry_all_zeros() or
> something like that?
Agree, we could still rename it later on if there is a need outside of
the statistics code area. Done in v2.
Regards,
-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size | 
|---|---|---|
| v2-0001-define-pgstat_entry_all_zeros-addr-s-r.patch | text/x-diff | 4.5 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2024-09-18 08:03:21 | Re: define pg_structiszero(addr, s, r) | 
| Previous Message | Peter Eisentraut | 2024-09-18 07:53:11 | Re: Remove shadowed declaration warnings |