worker_spi: Fix another stability issue with BGWORKER_BYPASS_ALLOWCONN
commitf483b209056b4181eb33b97cd6a30910a73c0f87
authorMichael Paquier <michael@paquier.xyz>
Tue, 10 Oct 2023 00:04:28 +0000 (10 09:04 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 10 Oct 2023 00:04:28 +0000 (10 09:04 +0900)
tree0f648a96df7eb9e9dc7dc4fcdbee8c12a94b8260
parent64aad6944c8d331ceb6a0b2df73bf70c5adaf35b
worker_spi: Fix another stability issue with BGWORKER_BYPASS_ALLOWCONN

worker_spi_launch() may report that a worker stopped when it fails to
connect on a database that does not allow connections if the worker
exits before the SQL function checks for the current status of the
worker.  The test is switched to use Cluster::psql instead of
safe_psql() so as it does not fail hard when this query errors.  While
on it, this removes a query that looks at pg_stat_activity to simplify
the test, as a check on the contents of the server logs achieves the
same when the worker cannot connect to the database without
datallowconn.

Per buildfarm members kestrel, mamba and serinus.  Bonus thanks to Tom
Lane for providing the logs of the failure from mamba that the buildfarm
was not able to show up.  Note that I have reproduced the failure with a
hardcoded stop point.

Discussion: https://postgr.es/m/3365937.1696801735@sss.pgh.pa.us
src/test/modules/worker_spi/t/001_worker_spi.pl