Thread: Re: pgsql: Unify several ways to tracking backend type

Re: pgsql: Unify several ways to tracking backend type

From
Alvaro Herrera
Date:
On 2020-Mar-13, Peter Eisentraut wrote:

> Unify several ways to tracking backend type
> 
> Add a new global variable MyBackendType that uses the same BackendType
> enum that was previously only used by the stats collector.  That way
> several duplicate ways of checking what type a particular process is
> can be simplified.  Since it's no longer just for stats, move to
> miscinit.c and rename existing functions to match the expanded
> purpose.

Now that I look at this again, I realize that these backend-type
descriptions are not marked translatable, which is at odds with what we
do with HandlChildCrash, for example.

Now, in addition to plastering _() to the strings, maybe we could use
that new function in postmaster.c, say

                HandleChildCrash(pid, exitstatus,
                                 GetBackendTypeDesc(B_CHECKPOINTER));

and so on.  Same with LogChildExit().  That'd reduce duplication.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services