pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: worker_spi: Expand set of options to start workers
Date: Thu, 05 Oct 2023 03:24:09 +0000
Message-ID: <E1qoEy8-0005jv-UI@gemulon.postgresql.org> (raw)

worker_spi: Expand set of options to start workers

A couple of new options are added to this module to provide more control
on the ways bgworkers are started:
- A new GUC called worker_spi.role to control which role to use by
default when starting a worker.
- worker_spi_launch() gains three arguments: a role OID, a database OID
and flags (currently only BGWORKER_BYPASS_ALLOWCONN).  By default, the
role OID and the database OID are InvalidOid, in which case the worker
would use the related GUCs.

Workers loaded by shared_preload_libraries use the default values
provided by the GUCs, with flags at 0.  The options are given to the
main bgworker routine through bgw_extra.  A test case is tweaked to
start two dynamic workers with databases and roles defined by the caller
of worker_spi_launch().

These additions will have the advantage of expanding the tests for
bgworkers, for at least two cases:
- BGWORKER_BYPASS_ALLOWCONN has no coverage in the core tree.
- A new bgworker flag is under discussion, and this eases the
integration of new tests.

Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/bcc36259-7850-4882-97ef-d6b905d2fc51@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4f2994647ff1e1209829a0085ca0c8d237dbbbb4

Modified Files
--------------
src/test/modules/worker_spi/t/001_worker_spi.pl | 29 +++++---
src/test/modules/worker_spi/worker_spi--1.0.sql |  6 +-
src/test/modules/worker_spi/worker_spi.c        | 90 ++++++++++++++++++++++++-
3 files changed, 114 insertions(+), 11 deletions(-)



Message-ID: <E1qoEy8-0005jv-UI@gemulon.postgresql.org>
Permalink:  ../E1qoEy8-0005jv-UI@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qoEy8-0005jv-UI@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: worker_spi: Expand set of options to start workers
  In-Reply-To: <E1qoEy8-0005jv-UI@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox