public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Subramanian,Ramachandran <[email protected]>
To: [email protected] <[email protected]>
Subject: Re: Replication Testing- How to introduce a Lag
Date: Fri, 20 Mar 2026 08:40:43 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Replication Testing- How to introduce a Lag
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox