Re: Inconsistency in startup process's MyBackendId and procsignal array registration with ProcSignalInit()

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Inconsistency in startup process's MyBackendId and procsignal array registration with ProcSignalInit()
Date: 2021-10-13 08:09:24
Message-ID: CALj2ACVH2tayQnUmLqH51_-sjgq0=ibg9K2JFa30L3iDA7EDNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 13, 2021 at 4:25 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> On 2021-10-11 15:24:46 +0900, Fujii Masao wrote:
> > How about modifying SharedInvalBackendInit() so that it accepts
> > BackendId as an argument and allocates the ProcState entry of
> > the specified BackendId? That is, the startup process determines
> > that its BackendId is "MaxBackends + MyAuxProcType (=StartupProcess) + 1"
> > in AuxiliaryProcessMain(), and then it passes that BackendId to
> > SharedInvalBackendInit() in InitRecoveryTransactionEnvironment().
>
> If I understand correctly what you're proposing, I think that's going in the
> wrong direction. We should work towards getting rid of BackendIds
> instead. This whole complication vanishes if we make sinvaladt use pgprocno.
>
> See https://postgr.es/m/20210802171255.k4yv5cfqaqbuuy6f%40alap3.anarazel.de
> for some discussion of this.

Will any of the backends get pgprocno greater than MaxBackends? The
pgprocno can range from 0 to ((MaxBackends + NUM_AUXILIARY_PROCS +
max_prepared_xacts) - 1) and the ProcState array size is MaxBackends.
How do we put a backend with pgprocno > MaxBackends, into the
ProcState array? Is it that we also increase ProcState array size to
(MaxBackends + NUM_AUXILIARY_PROCS + max_prepared_xacts)? Probably
this is the dumbest thing as some slots are unused
(NUM_AUXILIARY_PROCS - 1 + max_prepared_xacts slots. -1 because the
startup process needs a ProcState slot) and the shared memory is
wasted.

Regards,
Bharath Rupireddy.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2021-10-13 08:10:12 Re: Added schema level support for publication.
Previous Message Stephen Frost 2021-10-13 08:00:51 Re: should we allow users with a predefined role to access pg_backend_memory_contexts view and pg_log_backend_memory_contexts function?gr