Stabilize 051_effective_wal_level.pl.

Several tests in 051_effective_wal_level.pl quit a background psql
session that attached a local injection point and then immediately
start another session that attaches the same injection point. A local
injection point is detached only when its backend exits, and quitting
the background psql session doesn't wait for that. So if the old
backend is slow to exit, the new session fails to attach the injection
point because it is still defined, and the test times out waiting for
a backend to stop at it.

Fix by waiting for the old backend to disappear from pg_stat_activity
view after quitting the session. Detaching the injection point before
quitting isn't enough, because the exiting backend still detaches it
by name and could remove the one the next session has just attached.

Per buildfarm member melonworm.

Reported-by: Alexander Lakhin <[email protected]>
Author: Hayato Kuroda <[email protected]>
Reviewed-by: Masahiko Sawada <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9c8418d0141d4f80f550cee2eb777c19454a2e07

Modified Files
--------------
src/test/recovery/t/051_effective_wal_level.pl | 37 +++++++++++++++++++++-----
1 file changed, 31 insertions(+), 6 deletions(-)

Reply via email to