Re: Support worker_spi to execute the function dynamically.

Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>

From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Masahiro Ikeda <ikedamsh@oss.nttdata.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-07-21T06:51:57Z
Lists: pgsql-hackers
On Fri, Jul 21, 2023 at 11:54 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Fri, Jul 21, 2023 at 11:24:08AM +0530, Bharath Rupireddy wrote:
> > Okay. Here's a quick patch for adding TAP tests to the worker_spi
> > module. We can change it to taste.
>
> What do you think if we removed completely the sql/ test, moving it to
> TAP so as we have only one cluster set up when running a make check?
> worker_spi.sql only does two waits (one for the initialization and one
> to check that the tuple has been processed), so these could be
> replaced by some poll_query_until()?

I think we can keep SQL tests around as it will help demonstrate
someone quickly write their own SQL tests.

> As we have a dynamic.conf, installcheck is not supported so we don't
> use anything with this switch.  Besides, updating
> shared_preload_libraries and restarting the node in TAP is cheaper
> than a second initdb.

In SQL tests, I ensured worker_spi doesn't start static bg workers by
setting worker_spi.total_workers = 0. Again, all of this is not
necessary, but it will be a very good example for someone writing
extensions and play around with custom config files, SQL and TAP tests
etc.

-- 
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



Commits

  1. worker_spi: Fix race condition in newly-added TAP tests

  2. worker_spi: Switch to TAP tests

  3. worker_spi: Use term "dynamic" for bgworkers launched with worker_spi_launch()

  4. Fix worker_spi when launching workers without shared_preload_libraries