Standby recovers records from wrong timeline

From: Ants Aasma <ants(at)cybertec(dot)at>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Standby recovers records from wrong timeline
Date: 2022-10-19 15:50:09
Message-ID: CANwKhkMN3QwAcvuDZHb6wsvLRtkweBiYso-KLFykkQVWuQLcOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Engineerwww.cybertec-postgresql.com

Attachment Content-Type Size
recoverytest.sh application/x-shellscript 1.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-10-19 15:53:51 Re: Avoid memory leaks during base backups
Previous Message Alvaro Herrera 2022-10-19 15:38:50 Re: interrupted tap tests leave postgres instances around