Add background worker type

Enterprise / PostgreSQL - Peter Eisentraut [gmx.net] - 29 September 2017 11:08 EDT

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.

5373bc2 Add background worker type
contrib/pg_prewarm/autoprewarm.c | 6 ++--
doc/src/sgml/bgworker.sgml | 11 +++++--
src/backend/access/transam/parallel.c | 1 +
src/backend/postmaster/bgworker.c | 51 +++++++++++++++++++++++++++---
src/backend/postmaster/postmaster.c | 5 +--
src/backend/replication/logical/launcher.c | 3 ++
src/backend/utils/adt/pgstatfuncs.c | 16 ++++++++--
src/include/postmaster/bgworker.h | 2 ++
src/test/modules/test_shm_mq/setup.c | 2 +-
src/test/modules/worker_spi/worker_spi.c | 8 +++--
10 files changed, 89 insertions(+), 16 deletions(-)

Upstream: git.postgresql.org


  • Share