Re: Replication Testing- How to introduce a Lag
Laurenz Albe <laurenz.albe@cybertec.at>
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: "Subramanian,Ramachandran" <ramachandran.subramanian@alte-leipziger.de>,
"pgsql-novice@lists.postgresql.org" <pgsql-novice@lists.postgresql.org>
Date: 2026-03-20T07:40:43Z
Lists: 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