Re: pgsql: Refactor how some aux processes advertise their ProcNumber - Mailing list pgsql-committers

From Fujii Masao
Subject Re: pgsql: Refactor how some aux processes advertise their ProcNumber
Date
Msg-id CAHGQGwH8n4BMjBJcL1ob6YTJYn1kTmVwO6mEYoEGyrGyNXaaXw@mail.gmail.com
Whole thread
Responses Re: pgsql: Refactor how some aux processes advertise their ProcNumber
List pgsql-committers
On Thu, Jul 9, 2026 at 6:57 AM Thom Brown <thom@linux.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

pgsql-committers by date:

Previous
From: Richard Guo
Date:
Subject: pgsql: Add an enable_groupagg GUC parameter
Next
From: Amit Kapila
Date:
Subject: pgsql: Doc: Clarify sequence synchronization commands.