Re: pgsql: Refactor how some aux processes advertise their ProcNumber

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Refactor how some aux processes advertise their ProcNumber
Date: 2026-07-09 00:57:27
Message-ID: CAHGQGwH8n4BMjBJcL1ob6YTJYn1kTmVwO6mEYoEGyrGyNXaaXw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Thu, Jul 9, 2026 at 6:57 AM Thom Brown <thom(at)linux(dot)com> wrote:
> @@ -724,6 +725,14 @@ InitAuxiliaryProcess(void)
> */
> PGSemaphoreReset(MyProc->sem);
>
> + /* Some aux processes are also advertised in ProcGlobal */
> + if (MyBackendType == B_AUTOVAC_LAUNCHER)
> + pg_atomic_write_u32(&ProcGlobal->avLauncherProc, MyProcNumber);
>
> I'm looking for the places this gets called from. I can only see
> auxprocess.c which the launcher doesn't go through. The same question
> for similar code in AuxiliaryProcKill().

You're right. The autovacuum launcher does not go through
AuxiliaryProcessMainCommon(), so it never calls
InitAuxiliaryProcess(). Instead, it initializes its PGPROC with
InitProcess().

As a result, the avLauncherProc assignment added to
InitAuxiliaryProcess() is never executed for the launcher, and the
corresponding cleanup in AuxiliaryProcKill() is never reached either.

It seems we should move the avLauncherProc set/clear operations to
InitProcess()/ProcKill() path, as in the attached patch.

Regards,

--
Fujii Masao

Attachment Content-Type Size
v1-0001-Advertise-autovacuum-launcher-s-ProcNumber-from-I.patch application/octet-stream 2.0 KB

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2026-07-09 02:55:59 pgsql: Doc: Clarify sequence synchronization commands.
Previous Message Richard Guo 2026-07-09 00:45:23 pgsql: Add an enable_groupagg GUC parameter