Re: pg_rewind success even though getting error 'record with incorrect prev-link'

From: Abdullah Al Maruf <maruf(dot)2hin(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_rewind success even though getting error 'record with incorrect prev-link'
Date: 2019-01-30 03:57:56
Message-ID: CANzStTBiqbj0tK0L3cbET1yr=JV9wB0y2rUvfpB3rqNGr_ZkoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Michael

> This is pointing out to the end of WAL for the current timeline. You
> may face it after reading a WAL segment in an area which has been used
> in the past for a recycled segment.

Are you talking about error ` LOG: invalid record length at 0/B000098:
wanted 24, got 0` ?
or,
`LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098`

Actually, the 1st error is not making any issue. This node starts to
streaming from primary successfully.
But when the second error comes, It appears every 5 seconds. And, the node
is not streaming from master.

pg_rewind still resolves timeline conflict, but it's not fixing this second
error.

Any work around??
----------------
My scenario, in short, I have 1 master nodes (0th node) and three standby
nodes (1st,

2nd & 3rd node). When I make the 3rd node as master (by trigger file) and
restarts 0th node as a replica, It shows no problem.

But when both nodes are offline and our leader selection chooses the 0th
node
as a master, and tries to reattach the 3rd node as Replica, It throws an
error similar to:

```
LOG: invalid record length at 0/B000098: wanted 24, got 0
LOG: started streaming WAL from primary at 0/B000000 on timeline 2
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
FATAL: terminating walreceiver process due to administrator command
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
```

If I disable archive_mode, I never faced this error with the same script. It
only appears when archive is on, and also not all the times it happens but
most of the time it does.
The error message appears after every 5 seconds.

Scenario In details:

I have two folders for scripts.

├── primary
│ ├── postgresql.conf
│ ├── restore.sh
│ ├── run.sh
│ └── start.sh
└── replica
├── recovery.conf
└── run.sh

I have a system that will choose the leader. If the current pod is the
leader,
it will run `primary/run.sh`, and If it is a replica, it will run
`replica/run.sh`.

The files can be found here.

https://github.com/kubedb/postgres/tree/pg-db/hack/docker/postgres/9.6.7/scripts

On Wed, Jan 30, 2019 at 7:44 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Tue, Jan 29, 2019 at 07:13:11PM +0600, Abdullah Al Maruf wrote:
> > When I try to attach an old master with 'archiving set to on` as a new
> > standby, `pg_rewind` doesn't throw any error, But, when the database
> > starts, The following error appears:
> >
> > ```
> > LOG: invalid record length at 0/B000098: wanted 24, got 0
> > LOG: started streaming WAL from primary at 0/B000000 on timeline 2
> > LOG: record with incorrect prev-link 10000/21B0000 at 0/B000098
> > FATAL: terminating walreceiver process due to administrator command
>
> This is pointing out to the end of WAL for the current timeline. You
> may face it after reading a WAL segment in an area which has been used
> in the past for a recycled segment.
> --
> Michael
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-01-30 05:58:53 Re: Querying w/ join slow for large/many child tables
Previous Message Adrian Klaver 2019-01-30 03:30:16 Re: Querying w/ join slow for large/many child tables