1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-21 12:05:57 +03:00

Another try to fix BF failure introduced in commit ddd5f4f54a.

Before attempting to sync the slot on standby by
pg_sync_replication_slots(), ensure that on the primary restart_lsn for
the slot has moved to a recent WAL position, by re-creating the
subscription and the logical slot.

Author: Hou Zhijie
Discussion: https://postgr.es/m/CAA4eK1+d5Lne8vCAn0un4SP9x-ZBr2-xfxg01uSfeBTSCKFZoQ@mail.gmail.com
This commit is contained in:
Amit Kapila 2024-02-15 10:37:28 +05:30
parent 0c444a70f2
commit 9bc1eee988

View File

@ -223,17 +223,14 @@ is( $standby1->safe_psql(
$standby1->append_conf('postgresql.conf', 'max_slot_wal_keep_size = -1'); $standby1->append_conf('postgresql.conf', 'max_slot_wal_keep_size = -1');
$standby1->reload; $standby1->reload;
# Enable the subscription to let it catch up to the latest wal position # To ensure that restart_lsn has moved to a recent WAL position, we re-create
$subscriber1->safe_psql('postgres', # the subscription and the logical slot.
"ALTER SUBSCRIPTION regress_mysub1 ENABLE"); $subscriber1->safe_psql(
'postgres', qq[
DROP SUBSCRIPTION regress_mysub1;
CREATE SUBSCRIPTION regress_mysub1 CONNECTION '$publisher_connstr' PUBLICATION regress_mypub WITH (slot_name = lsub1_slot, copy_data = false, failover = true);
]);
# 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'); $primary->wait_for_catchup('regress_mysub1');
# Do not allow any further advancement of the restart_lsn for the lsub1_slot. # Do not allow any further advancement of the restart_lsn for the lsub1_slot.