mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Fix the testcase introduced in commit 81d20fbf7a.
The failed test was syncing failover replication slot to standby to test that we remove such slots after the standby is converted to subscriber by pg_createsubscriber. In one of the buildfarm members, the sync of the slot failed because the LSN on the standby was before the syncslot's LSN. We need to wait for standby to catch up before trying to sync the slot with pg_sync_replication_slots(). The other buildfarm failed because autovacuum generated a xid which is replicated to the standby at some random point making slots at primary lag behind standby during slot sync. Both these failures wouldn't have occurred if we had used built-in slotsync worker as it would have waited for the standby to sync with primary but for this test, it is sufficient to use pg_sync_replication_slots(). Reported-by: Alexander Lakhin as per buildfarm Author: Kuroda Hayato Reviewed-by: Amit Kapila Backpatch-through: 17 Discussion: https://postgr.es/m/0dffca12-bf17-4a7a-334d-225569de5e6e@gmail.com Discussion: https://postgr.es/m/OSBPR01MB25528300C71FDD83EA1DCA12F5DD2@OSBPR01MB2552.jpnprd01.prod.outlook.com
This commit is contained in:
parent
9fd0252579
commit
ae395f0f7e
@ -116,6 +116,10 @@ command_fails(
|
||||
my $node_p = PostgreSQL::Test::Cluster->new('node_p');
|
||||
my $pconnstr = $node_p->connstr;
|
||||
$node_p->init(allows_streaming => 'logical');
|
||||
# Disable autovacuum to avoid generating xid during stats update as otherwise
|
||||
# the new XID could then be replicated to standby at some random point making
|
||||
# slots at primary lag behind standby during slot sync.
|
||||
$node_p->append_conf('postgresql.conf', 'autovacuum = off');
|
||||
$node_p->start;
|
||||
|
||||
# Set up node F as about-to-fail node
|
||||
@ -293,6 +297,9 @@ $node_p->safe_psql($db1,
|
||||
"SELECT pg_create_logical_replication_slot('$fslotname', 'pgoutput', false, false, true)"
|
||||
);
|
||||
$node_s->start;
|
||||
# Wait for the standby to catch up so that the standby is not lagging behind
|
||||
# the failover slot.
|
||||
$node_p->wait_for_replay_catchup($node_s);
|
||||
$node_s->safe_psql('postgres', "SELECT pg_sync_replication_slots()");
|
||||
my $result = $node_s->safe_psql('postgres',
|
||||
"SELECT slot_name FROM pg_replication_slots WHERE slot_name = '$fslotname' AND synced AND NOT temporary"
|
||||
|
Loading…
x
Reference in New Issue
Block a user