Thread: Re: Refine comments on usage WL_POSTMASTER_DEATH vs WL_EXIT_ON_PM_DEATH

Re: Refine comments on usage WL_POSTMASTER_DEATH vs WL_EXIT_ON_PM_DEATH

From
"David G. Johnston"
Date:
On Wednesday, October 23, 2024, Pavel Borisov <pashkin.elfe@gmail.com> wrote:

In fact, in parts of the code, it's currently used to immediately exit or throw FATAL (in the walsender and in libpq).

Maybe submit a patch to fix these parts of the code that should apparently be using WL_EXIT_ON_PM_DEATH to do so instead of an unnecessary self-directed exit?

The comment needn’t tell the developer that it is possible code things in such a way using WL_POSTMASTER_DEATH that is redundant with what they could more easily accomplish using WL_EXIT_ON_PM_DEATH.  Doing nothing is always an option, but one not recommended and thus not pointed out.

The only thing that I could see not leaving implied is that if you don’t use WL_EXIT_ON_PM_DEATH and the postmaster does die your handler code must terminate your process explicitly (I suppose “must” really is “should” because I suspect when the postmaster is done dead it will have taken its children to /dev/null along with it…).

David J.