summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorPeter Eisentraut2017-08-31 16:24:47 +0000
committerPeter Eisentraut2017-09-29 15:08:24 +0000
commit5373bc2a0867048bb78f93aede54ac1309b5e227 (patch)
treea330b6841f88d58831746b8d82e206174234a509 /src/include
parent8b304b8b72b0a60f1968d39f01cf817c8df863ec (diff)
Add background worker type
Add bgw_type field to background worker structure. It is intended to be set to the same value for all workers of the same type, so they can be grouped in pg_stat_activity, for example. The backend_type column in pg_stat_activity now shows bgw_type for a background worker. The ps listing also no longer calls out that a process is a background worker but just show the bgw_type. That way, being a background worker is more of an implementation detail now that is not shown to the user. However, most log messages still refer to 'background worker "%s"'; otherwise constructing sensible and translatable log messages would become tricky. Reviewed-by: Michael Paquier <michael.paquier@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/postmaster/bgworker.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/postmaster/bgworker.h b/src/include/postmaster/bgworker.h
index e2ecd3c9eb..6b4e631880 100644
--- a/src/include/postmaster/bgworker.h
+++ b/src/include/postmaster/bgworker.h
@@ -88,6 +88,7 @@ typedef enum
typedef struct BackgroundWorker
{
char bgw_name[BGW_MAXLEN];
+ char bgw_type[BGW_MAXLEN];
int bgw_flags;
BgWorkerStartTime bgw_start_time;
int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */
@@ -122,6 +123,7 @@ extern BgwHandleStatus GetBackgroundWorkerPid(BackgroundWorkerHandle *handle,
extern BgwHandleStatus WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *handle, pid_t *pid);
extern BgwHandleStatus
WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *);
+extern const char *GetBackgroundWorkerTypeByPid(pid_t pid);
/* Terminate a bgworker */
extern void TerminateBackgroundWorker(BackgroundWorkerHandle *handle);