mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
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. Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/c65e5196-4f04-4ead-9353-6088c19615a3@2ndquadrant.com
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "libpq/libpq.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/ps_status.h"
|
||||
|
||||
@@ -247,14 +248,20 @@ save_ps_display_args(int argc, char **argv)
|
||||
|
||||
/*
|
||||
* Call this once during subprocess startup to set the identification
|
||||
* values. At this point, the original argv[] array may be overwritten.
|
||||
* values.
|
||||
*
|
||||
* If fixed_part is NULL, a default will be obtained from MyBackendType.
|
||||
*
|
||||
* At this point, the original argv[] array may be overwritten.
|
||||
*/
|
||||
void
|
||||
init_ps_display(const char *fixed_part)
|
||||
{
|
||||
bool save_update_process_title;
|
||||
|
||||
Assert(fixed_part);
|
||||
Assert(fixed_part || MyBackendType);
|
||||
if (!fixed_part)
|
||||
fixed_part = GetBackendTypeDesc(MyBackendType);
|
||||
|
||||
#ifndef PS_USE_NONE
|
||||
/* no ps display for stand-alone backend */
|
||||
|
||||
Reference in New Issue
Block a user