mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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>
This commit is contained in:
@ -800,7 +800,8 @@ apw_start_master_worker(void)
|
||||
worker.bgw_start_time = BgWorkerStart_ConsistentState;
|
||||
strcpy(worker.bgw_library_name, "pg_prewarm");
|
||||
strcpy(worker.bgw_function_name, "autoprewarm_main");
|
||||
strcpy(worker.bgw_name, "autoprewarm");
|
||||
strcpy(worker.bgw_name, "autoprewarm master");
|
||||
strcpy(worker.bgw_type, "autoprewarm master");
|
||||
|
||||
if (process_shared_preload_libraries_in_progress)
|
||||
{
|
||||
@ -840,7 +841,8 @@ apw_start_database_worker(void)
|
||||
worker.bgw_start_time = BgWorkerStart_ConsistentState;
|
||||
strcpy(worker.bgw_library_name, "pg_prewarm");
|
||||
strcpy(worker.bgw_function_name, "autoprewarm_database_main");
|
||||
strcpy(worker.bgw_name, "autoprewarm");
|
||||
strcpy(worker.bgw_name, "autoprewarm worker");
|
||||
strcpy(worker.bgw_type, "autoprewarm worker");
|
||||
|
||||
/* must set notify PID to wait for shutdown */
|
||||
worker.bgw_notify_pid = MyProcPid;
|
||||
|
Reference in New Issue
Block a user