Standby recovers records from wrong timeline - Mailing list pgsql-hackers

From Ants Aasma
Subject Standby recovers records from wrong timeline
Date
Msg-id CANwKhkMN3QwAcvuDZHb6wsvLRtkweBiYso-KLFykkQVWuQLcOw@mail.gmail.com
Whole thread Raw
Responses Re: Standby recovers records from wrong timeline  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
When standby is recovering to a timeline that doesn't have any segments archived yet it will just blindly blow past the timeline switch point and keeps on recovering on the old timeline. Typically that will eventually result in an error about incorrect prev-link, but under unhappy circumstances can result in standby silently having different contents.

Attached is a shell script that reproduces the issue. Goes back to at least v12, probably longer.

I think we should be keeping track of where the current replay timeline is going to end and not read any records past it on the old timeline. Maybe while at it, we should also track that the next record should be a checkpoint record for the timeline switch and error out if not. Thoughts?

--
Ants Aasma
Senior Database Engineer
www.cybertec-postgresql.com
Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: interrupted tap tests leave postgres instances around
Next
From: Bharath Rupireddy
Date:
Subject: Re: Avoid memory leaks during base backups