Author: Noah Misch Commit: Noah Misch Fix test race between primary XLOG_RUNNING_XACTS and standby logical slot. Before the previous commit, the test could hang until LOG_SNAPSHOT_INTERVAL_MS (15s), until checkpoint_timeout (300s), or indefinitely. An indefinite hang was awfully improbable. It entailed the test reaching checkpoint_timeout after a CREATE SUBSCRIPTION and before its DecodingContextFindStartpoint(). Back-patch to v16, which introduced the test. Reviewed by FIXME. Discussion: https://postgr.es/m/FIXME diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.pl index 61da915..f7b7fc7 100644 --- a/src/test/recovery/t/035_standby_logical_decoding.pl +++ b/src/test/recovery/t/035_standby_logical_decoding.pl @@ -466,4 +466,11 @@ $psql_subscriber{subscriber_stdin} .= "\n"; $psql_subscriber{run}->pump_nb(); +# See corresponding create_logical_slot_on_standby() code. +$node_standby->poll_query_until( + 'postgres', qq[ + SELECT restart_lsn IS NOT NULL + FROM pg_catalog.pg_replication_slots WHERE slot_name = 'tap_sub' + ]) or die "timed out waiting for logical slot to calculate its restart_lsn"; + # Speed up the subscription creation $node_primary->safe_psql('postgres', "SELECT pg_log_standby_snapshot()");