| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | "Ryo Matsumura (Fujitsu)" <matsumura(dot)ryo(at)fujitsu(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Concerns regarding code in pgstat_backend.c |
| Date: | 2026-02-06 07:34:44 |
| Message-ID: | aYWZlEGbVhN9e6df@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Feb 06, 2026 at 07:11:07AM +0000, Ryo Matsumura (Fujitsu) wrote:
> I found the code that is likely to cause bugs in the future. It's not currently a bug.
> Should I have misunderstood, please feel free to disregard this email.
Because this is a clear thinko. pgstat_bestart_final() is always a
code path taken after pgstat_beinit() for auxiliary processes and the
rest of the world. I am pretty sure that my intention here was to
use the argument and not MyProcNumber in the function
pgstat_create_backend() because we rely on MyProcNumber to be defined
when the create routine is called, and that's what
pgstat_bestart_final() offers as guarantee, due to pgstat_beinit().
There is no bug currently, but let's clean that up in all the branches
anyway for clarity and any future back-patch. Hence, what do you think
about the attached?
--
Michael
| Attachment | Content-Type | Size |
|---|---|---|
| pgstat-backend-procnum.patch | text/plain | 551 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Smith | 2026-02-06 07:38:55 | Re: [PATCH] Support automatic sequence replication |
| Previous Message | Peter Smith | 2026-02-06 07:28:06 | Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0 |