worker_spi: Use term "dynamic" for bgworkers launched with worker_spi_launch()
authorMichael Paquier <michael@paquier.xyz>
Wed, 26 Jul 2023 03:43:26 +0000 (12:43 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 26 Jul 2023 03:43:26 +0000 (12:43 +0900)
This gives a way to make a difference between workers registered when
the library is loaded with shared_preload_libraries and when these are
launched dynamically, in ps output or pg_stat_activity.

Extracted from a larger patch by the same author.

Author: Bharath Rupireddy
Reviewed-by: Masahiro Ikeda
Discussion: https://postgr.es/m/CALj2ACWR9ncAiDF73unqdJF1dmsA2R0efGXX2624X+YVxcAVWg@mail.gmail.com

src/test/modules/worker_spi/worker_spi.c

index ada0fb8ac73333a063a6a8f5cebd489d939d446f..903dcddef97ca2dea6a48a9cb51b0b7dd3582d56 100644 (file)
@@ -370,8 +370,8 @@ worker_spi_launch(PG_FUNCTION_ARGS)
        worker.bgw_restart_time = BGW_NEVER_RESTART;
        sprintf(worker.bgw_library_name, "worker_spi");
        sprintf(worker.bgw_function_name, "worker_spi_main");
-       snprintf(worker.bgw_name, BGW_MAXLEN, "worker_spi worker %d", i);
-       snprintf(worker.bgw_type, BGW_MAXLEN, "worker_spi");
+       snprintf(worker.bgw_name, BGW_MAXLEN, "worker_spi dynamic worker %d", i);
+       snprintf(worker.bgw_type, BGW_MAXLEN, "worker_spi dynamic");
        worker.bgw_main_arg = Int32GetDatum(i);
        /* set bgw_notify_pid so that we can use WaitForBackgroundWorkerStartup */
        worker.bgw_notify_pid = MyProcPid;