Fix 051_effective_wal_level.pl on builds without injection points.

Commit 2af1dc8928 placed the new "logical decoding disabled after
REPACK (CONCURRENTLY)" check at the end of
051_effective_wal_level.pl. That placement assumed the logical slot
"test_slot" no longer existed when the check ran, but the assumption
only holds on builds with injection points: the earlier
injection-point-driven tests drop "test_slot" as a side effect, while
on builds without injection points the slot persists.  When
"test_slot" still exists, logical decoding remains enabled and the new
check fails on those buildfarm members.

Move the REPACK test earlier in the script, ensuring that the test
starts with logical decoding disabled.

Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAD21AoBmdmBQ-+Jga+jSKKq5OPGEP1pEjSJfRPT6MCwVHLD6og@mail.gmail.com
This commit is contained in:
Masahiko Sawada 2026-05-27 15:52:30 -07:00
parent 2af1dc8928
commit 47ad2233fa

View file

@ -65,6 +65,20 @@ ok( $primary->log_contains(
# Wait for the checkpointer to disable logical decoding.
wait_for_logical_decoding_disabled($primary);
# Test that logical decoding is disabled after repack
$primary->safe_psql('postgres', qq[create table foo(a int primary key)]);
$primary->safe_psql('postgres', qq[repack (concurrently) foo;]);
ok( $primary->log_contains(
"logical decoding is enabled upon creating a new logical replication slot"
),
"logical decoding enabled by repack");
# Wait for the checkpointer to disable logical decoding.
wait_for_logical_decoding_disabled($primary);
test_wal_level($primary, "replica|replica",
"logical decoding disabled after repack"
);
# Create a new logical slot and check that effective_wal_level must be increased
# to 'logical'.
$primary->safe_psql('postgres',
@ -400,20 +414,6 @@ select pg_cancel_backend(pid) from pg_stat_activity where query ~ 'slot_canceled
"the activation process aborted");
}
# Test that logical decoding is disabled after repack
$primary->safe_psql('postgres', qq[create table foo(a int primary key)]);
$primary->safe_psql('postgres', qq[repack (concurrently) foo;]);
ok( $primary->log_contains(
"logical decoding is enabled upon creating a new logical replication slot"
),
"logical decoding enabled by repack");
# Wait for the checkpointer to disable logical decoding.
wait_for_logical_decoding_disabled($primary);
test_wal_level($primary, "replica|replica",
"logical decoding disabled after repack"
);
$primary->stop;
done_testing();