Re: Replication Testing- How to introduce a Lag

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "Subramanian,Ramachandran" <ramachandran(dot)subramanian(at)alte-leipziger(dot)de>, "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: Replication Testing- How to introduce a Lag
Date: 2026-03-20 07:40:43
Message-ID: f3927bc3a9baf4400325b91652869907f0581c97.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Subramanian,Ramachandran 2026-03-20 10:47:13 AW: Replication Testing- How to introduce a Lag
Previous Message Subramanian,Ramachandran 2026-03-20 06:33:32 Replication Testing- How to introduce a Lag