At Tue, 15 Jun 2021 07:05:07 -0700 (MST), "email2ssk...@gmail.com" 
<email2ssk...@gmail.com> wrote in 
> Even I have this problem when I had to recover the database failed
> switchover.
> This is error is new primary server. 
> 
> < 2021-06-15 16:05:02.480 CEST > ERROR:  requested starting point
> AF/7D000000 on timeline 1 is not in this server's history
> < 2021-06-15 16:05:02.480 CEST > DETAIL:  This server's history forked from
> timeline 1 at AF/7C0F8D58.

Your old primary looks like having continued running beyond 7D000000
after the old standby promoted at 7C0F8D58.  In short, the new standby
experienced a diverged history from the new primary.

You can use pg_rewind to adust the new standby sever in that case.


FYI, you can reproduce the error by the folowing steps.

1. create a primary  (A)
2. create a standby  (B) connecting to A.
3. promote B.

4. connecting to A and run the following commands.

   =# select pg_switch_wal(); checkpoint;

5. stop A, then add primary_conninfo connecting to B to the conf file
   of A,then create the standby.signal file in the data directory of
   A.

6. You will get the similar error.


To recover from the sitaution, run pg_rewind like the follows, for example.

$ pg_rewind --target_pgdata=<datadir of A> --target-server='connstr to B'
pg_rewind: servers diverged at WAL location 0/3000060 on timeline 1
pg_rewind: rewinding from last common checkpoint at 0/2000060 on timeline 1


regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


Reply via email to