pgsql: Improve more stability of worker_spi termination test

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve more stability of worker_spi termination test
Date: 2026-04-06 04:23:39
Message-ID: E1w9bUw-003BIo-2v@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve more stability of worker_spi termination test

Alexander Lakhin has noticed that it can be possible on machines with
slow storage to have the spawned workers be stuck in
initialize_worker_spi(), before they reach their main loop. Waiting for
a flush to happen would block the interrupt attempts done by the
database commands, causing the test to fail on timeout once the number
of interrupt attempts is reached in CountOtherDBBackends().

This commit switches the test to wait for the spawned bgworkers to reach
their main loops before attempting the database commands that would
trigger the interrupts, napping for a time larger than the default, with
worker_spi.naptime set at 10 minutes. Another thing that could be
attempted is to enforce a larger number of tries in
CountOtherDBBackends(), if what is done here is not enough. Let's see
first if what this commit does is enough for the buildfarm members
widowbird and jay.

Analyzed-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Discussion: https://postgr.es/m/f913fba1-da59-404c-9eb3-07c7304be637@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/283c5fb22b44562428700284aad23eb5245b19d8

Modified Files
--------------
src/test/modules/worker_spi/t/002_worker_terminate.pl | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-04-06 05:03:25 pgsql: Use single LWLock for lock statistics in pgstats
Previous Message Fujii Masao 2026-04-06 04:21:44 pgsql: Simplify redundant current_database() subqueries in stats.sql re