mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-17 19:30:00 +08:00
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
This commit is contained in:
parent
b8f9e77725
commit
bd8fc1677b
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user