diff options
author | Amit Kapila | 2024-02-14 10:46:08 +0000 |
---|---|---|
committer | Amit Kapila | 2024-02-14 10:46:08 +0000 |
commit | bd8fc1677b88ed80e4e00e0e46401ec537952482 (patch) | |
tree | 48ff60ffdf2f99b1488b0273ba2c104316084c42 /src | |
parent | b8f9e7772595bf8527ded33884d5ed9f16e0653d (diff) |
Fix BF introduced in commit ddd5f4f54a.
The failure is that the remote slot is not synchronized after the same
slot on standby gets invalidated. The reason was that remote_slot's
restart_lsn was lagged behind the standby's oldest WAL segment. The test
didn't ensure that remote_slot's LSN was advanced to the latest position
before we tried to sync the slots via new the function
pg_sync_replication_slots().
Discussion: https://postgr.es/m/CAA4eK1JLBi3HzenB6do3_hd78kN0UDD1mz-vumWE52XHHEq5Bw@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/test/recovery/t/040_standby_failover_slots_sync.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl index c96515d178b..9634a50b3ec 100644 --- a/src/test/recovery/t/040_standby_failover_slots_sync.pl +++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl @@ -171,7 +171,7 @@ $standby1->safe_psql('postgres', "SELECT pg_sync_replication_slots();"); # flagged as 'synced' is( $standby1->safe_psql( 'postgres', - q{SELECT count(*) = 2 FROM pg_replication_slots WHERE slot_name IN ('lsub1_slot', 'lsub2_slot') AND synced;} + q{SELECT count(*) = 2 FROM pg_replication_slots WHERE slot_name IN ('lsub1_slot', 'lsub2_slot') AND synced AND NOT temporary;} ), "t", 'logical slots have synced as true on standby'); @@ -227,6 +227,13 @@ $standby1->reload; $subscriber1->safe_psql('postgres', "ALTER SUBSCRIPTION regress_mysub1 ENABLE"); +# This wait ensures that confirmed_flush_lsn has been moved to latest +# position. +$primary->wait_for_catchup('regress_mysub1'); + +# To ensure that restart_lsn has moved to a recent WAL position, we need +# to log XLOG_RUNNING_XACTS and make sure the same is processed as well +$primary->psql('postgres', "CHECKPOINT"); $primary->wait_for_catchup('regress_mysub1'); # Do not allow any further advancement of the restart_lsn for the lsub1_slot. @@ -256,7 +263,7 @@ $standby1->wait_for_log(qr/dropped replication slot "lsub1_slot" of dbid [0-9]+/ # flagged as 'synced' is( $standby1->safe_psql( 'postgres', - q{SELECT conflict_reason IS NULL AND synced FROM pg_replication_slots WHERE slot_name = 'lsub1_slot';} + q{SELECT conflict_reason IS NULL AND synced AND NOT temporary FROM pg_replication_slots WHERE slot_name = 'lsub1_slot';} ), "t", 'logical slot is re-synced'); |