| From: | Tomas Vondra <tomas(at)vondra(dot)me> |
|---|---|
| To: | surya poondla <suryapoondla4(at)gmail(dot)com> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, shihao zhong <zhong950419(at)gmail(dot)com> |
| Subject: | Re: A bug in recovery prefetcher, triggering asserts / FATAL: checkpoint request failed |
| Date: | 2026-11-19 18:28:34 |
| Message-ID: | 9aa7e573-3a49-4ae1-8e55-ce91dd828aff@vondra.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 10/27/26 23:50, surya poondla wrote:
>
> Hi Tomas,
>
> Thanks for the patch. I went through it and the fix looks right to me.
>
> I also looked at the other callers of XLogPrefetcherBeginRead(), and I
> agree with the commit message: apart from FinishWalRecovery(), each of
> them runs after at most one
> record has been read and returned, so prefetcher->record is already NULL
> there.
>
> The reason this goes unnoticed on non-assert builds is that
> FinishWalRecovery() throws away the result of ReadRecord(). Even with
> emode = PANIC, ReadRecord() just returns NULL quietly when there's no
> errormsg, and EndRecPtr is still the start of the record, which matches
> what you describe. I couldn't find a case where re-reading the last
> replayed record is expected to fail, so maybe it's worth adding a check
> there, probably as a separate patch:
>
> XLogPrefetcherBeginRead(xlogprefetcher, lastRec);
> if (ReadRecord(xlogprefetcher, PANIC, false, lastRecTLI) == NULL)
> elog(PANIC, "could not re-read last replayed record at
> %X/%08X",
> LSN_FORMAT_ARGS(lastRec));
>
> That way, if something like this ever happens again, it would fail loudly.
>
> Regards,
> Surya Poondla
Thanks for the reviews. I've pushed and backpatched this. I've been
wondering whether to include the TAP test, or whether it was only useful
when investigating the issue. I ended up committing it too. It's pretty
quick (at least compared to some other TAP tests for recovery), and it
seems useful enough.
regards
--
Tomas Vondra
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-11-19 18:45:46 | Re: [PATCH] Fix encoding-dependent LIKE/regex selectivity estimates |
| Previous Message | Fujii Masao | 2026-11-19 17:46:48 | Re: [BUG] Take a long time to reach consistent after pg_rewind |