From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Remove useless pointer advance in StatsShmemInit() |
Date: | 2025-08-18 09:13:05 |
Message-ID: | aKLuoUi01R3t5hIf@paquier.xyz |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Aug 18, 2025 at 09:04:59AM +0000, Bertrand Drouvot wrote:
> As StatsShmemInit() is existing code, let's fix it: the pointer is not used after
> its last advance, so that advance is unnecessary and can be removed.
> @@ -180,7 +180,6 @@ StatsShmemInit(void)
* provides a small efficiency win.
*/
ctl->raw_dsa_area = p;
- p += MAXALIGN(pgstat_dsa_init_size());
dsa = dsa_create_in_place(ctl->raw_dsa_area,
pgstat_dsa_init_size(),
LWTRANCHE_PGSTATS_DSA, NULL);
I'd bet that this is a vestige of the earlier versions discussed for
the pgstats shmem patch, where !IsUnderPostmaster was doing a few more
things with this pointer going down.
One could argue that "p" could be removed, moving the
sizeof(PgStat_ShmemControl) when we set raw_dsa_area, but that's a bit
cleaner with the extra pointer assignment and the comment for
pgStatLocal.shmem. So, why not.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2025-08-18 09:13:13 | Re: Logical Replication of sequences |
Previous Message | Kirill Reshke | 2025-08-18 09:05:20 | Re: test_ddl_deparse: Rename test create_sequence_1 |