Re: Recovery at replica stuck because recovery incorrectly trusts an old high-water mark

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: 4e611ee8-14e3-423f-bbc8-a7b547358520(at)garret(dot)ru, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Recovery at replica stuck because recovery incorrectly trusts an old high-water mark
Date: 2026-09-25 01:21:34
Message-ID: dbab64e5c2dc2d7549280b72d25751a94cedd07b.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2026-09-24 at 21:30 +0300, Konstantin Knizhnik wrote:
> v2 keeps flushedUpto monotonic.  Startup uses a separate
> applyFlushedUpto for "is this streamed WAL readable?"

The reread-from-primary behavior seems to trace to 6da07cd80d, which
looks more like an opportunistic retry than a policy.

We could make it a policy to try to get readable WAL from the primary,
and then keep the extra state you propose. But I think we need more
explanation about why we'd expect this situation (corrupt and flushed
on standby and valid on primary) to occur.

For instance:

/* ...Only after a failed read of
* WAL that flushedUpto still reports as present do we
* rewind the apply pointer, so startup waits for
* replacement bytes.

raises questions for anyone reading that code about why it might be
flushed and unreadable.

Regards,
Jeff Davis

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Osama Abdul Qader 2026-09-25 01:23:18 Re: Severe performance degradation with concurrent updates due to excessive EvalPlanQual (EPQ) re‑evaluation
Previous Message Amit Langote 2026-09-25 01:02:18 Re: potentially missed pgindent in REL_19_STABLE