Re: some questions regarding replication issues and timeline/history files

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: email2ssk247(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: some questions regarding replication issues and timeline/history files
Date: 2021-06-16 06:05:57
Message-ID: 20210616.150557.1626494965993879713.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At Tue, 15 Jun 2021 07:05:07 -0700 (MST), "email2ssk247(at)gmail(dot)com" <email2ssk247(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Atul Kumar 2021-06-16 06:28:56 Re: query issue
Previous Message Julien Rouhaud 2021-06-16 05:12:20 Re: pg_basebackup fails with "COPY stream ended"