postgres.git / summary / log / commit / refs

commit    5c808b8c5c395a7d7afea7efaaa3328b4bc4e004
Author:   Masahiko Sawada <msawada@postgresql.org>
Date:     Thu Jul 30 23:17:13 2026 +0000

    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


src/test/recovery/t/051_effective_wal_level.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/recovery/t/051_effective_wal_level.pl b/src/test/recovery/t/051_effective_wal_level.pl index 5990d76888d..401a67ad1a6 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"); [parent: 6a80179f6b09]