Re: Replication Testing- How to introduce a Lag - Mailing list pgsql-novice

From Laurenz Albe
Subject Re: Replication Testing- How to introduce a Lag
Date
Msg-id f3927bc3a9baf4400325b91652869907f0581c97.camel@cybertec.at
Whole thread Raw
In response to Replication Testing- How to introduce a Lag  ("Subramanian,Ramachandran" <ramachandran.subramanian@alte-leipziger.de>)
Responses AW: Replication Testing- How to introduce a Lag
List pgsql-novice
On Fri, 2026-03-20 at 06:33 +0000, Subramanian,Ramachandran wrote:
> I have set up streaming replication in a our test environment and it is working OK .
>
> 1. Is there a way to  force a lag between the source and the stand-by in an environment where there is NO load?

Yes, set "recovery_min_apply_delay" on the standby.

> 2. During the set up process as I was thrashing around from server to server I received this message
>    in the stand-by if I make the standby follow a new server B after it had been following a server A.
>    what seems to work is, additionally clearing out the archive logs dir of the standby server along
>    with the data dir, before running the pg_basebackup from the standby.  I am extremely new to
>    postgres and  I want to make sure that what I am doing is not a dangerous practice.
>
> FATAL: requested timeline 2 is not a child of this server's history

You have "recovery_timeline = 'latest'" on the standby, right?

Then the standby that gives you that error probably followed the original primary to
a point past where the new primary forked off timeline 1.

You need to shutdown the standby that gives you the error message and run "pg_rewind"
to reposition it to follow the new primary.  Prerequisite: "wal_log_hints = on" or
data checksums enabled.
Otherwise you need to rebuild the standby with a new pg_basebackup.

Yours,
Laurenz Albe



pgsql-novice by date:

Previous
From: "Subramanian,Ramachandran"
Date:
Subject: Replication Testing- How to introduce a Lag
Next
From: "Subramanian,Ramachandran"
Date:
Subject: AW: Replication Testing- How to introduce a Lag