From: Masahiko Sawada Date: Thu, 30 Jul 2026 23:17:10 +0000 (-0700) Subject: Fix background psql session cleanup in 051_effective_wal_level.pl. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=18f9785e0b3aa75b5c61fb3dd35d9f4fd6723d49;p=thirdparty%2Fpostgresql.git Fix background psql session cleanup in 051_effective_wal_level.pl. Commit 6aba42c660c added quit() calls for two background psql sessions whose slot creation is canceled by pg_cancel_backend(). Both sessions ran with the default ON_ERROR_STOP=1 and ended their script with \q, so psql exited as soon as the cancellation error arrived. quit() then wrote another \q to the already-closed pipe, making the test die with "ack Broken pipe". Run both sessions with on_error_stop => 0 and drop the trailing \q, so that psql stays at the prompt after reporting the error and quit() can shut it down cleanly. Discussion: https://postgr.es/m/CAD21AoCZY1fKYgfkvHGWGiXpatUKd23FSLnDCL4m9bWFjdXNZw@mail.gmail.com Backpatch-through: 19 --- diff --git a/src/test/recovery/t/051_effective_wal_level.pl b/src/test/recovery/t/051_effective_wal_level.pl index 02f750097bd..11bf4cb6134 100644 --- a/src/test/recovery/t/051_effective_wal_level.pl +++ b/src/test/recovery/t/051_effective_wal_level.pl @@ -438,7 +438,8 @@ select pg_drop_replication_slot('slot_2'); # Start a psql session to test the case where the activation process is # interrupted. - $psql_create_slot = $primary->background_psql('postgres'); + $psql_create_slot = + $primary->background_psql('postgres', on_error_stop => 0); # Start the logical decoding activation process upon creating the logical # slot, but it will wait due to the injection point. @@ -448,7 +449,6 @@ select pg_drop_replication_slot('slot_2'); select injection_points_set_local(); select injection_points_attach('logical-decoding-activation', 'wait'); select pg_create_logical_replication_slot('slot_canceled', 'pgoutput'); -\q )); $primary->wait_for_event('client backend', 'logical-decoding-activation'); @@ -470,7 +470,8 @@ select pg_cancel_backend(pid) from pg_stat_activity where query ~ 'slot_canceled $psql_create_slot->quit; # Test concurrent activation processes run and one is interrupted. - $psql_create_slot = $primary->background_psql('postgres'); + $psql_create_slot = + $primary->background_psql('postgres', on_error_stop => 0); # Start a psql session and stops in the middle of the activation # process. @@ -480,7 +481,6 @@ select pg_cancel_backend(pid) from pg_stat_activity where query ~ 'slot_canceled select injection_points_set_local(); select injection_points_attach('logical-decoding-activation', 'wait'); select pg_create_logical_replication_slot('slot_canceled2', 'pgoutput'); -\q )); $primary->wait_for_event('client backend', 'logical-decoding-activation'); note("injection_point 'logical-decoding-activation' is reached");