Re: Non-robustness in pmsignal.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Non-robustness in pmsignal.c
Date
Msg-id 3658511.1665251081@sss.pgh.pa.us
Whole thread Raw
In response to Re: Non-robustness in pmsignal.c  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> When can PostmasterContext be NULL here, and why can we just continue without
> (re-)allocating PMChildInUse?

We'd only get into the !found stanza in a postmaster or a
standalone backend.  A standalone backend isn't ever going to call
AssignPostmasterChildSlot or ReleasePostmasterChildSlot, so it
does not need the array; and it also doesn't have a PostmasterContext,
so there's not a good place to allocate the array either.

Perhaps there's a better way to distinguish am-I-a-postmaster,
but I thought checking PostmasterContext is fine since that ties
directly to what the code needs to do.

Yes, the code would malfunction if the PostmasterContext != NULL
condition changed from one cycle to the next, but that shouldn't
happen.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: START_REPLICATION SLOT causing a crash in an assert build
Next
From: Marina Polyakova
Date:
Subject: Re: ICU for global collation