| From: | solai v <solai(dot)cdac(at)gmail(dot)com> |
|---|---|
| To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
| Cc: | surya poondla <suryapoondla4(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Fix XLogFileReadAnyTLI silently applying divergent WAL from wrong timeline |
| Date: | 2026-09-18 06:31:59 |
| Message-ID: | CAF0whueMxSOUjatYJaA1mCePR+FrK7jPW=b2h-bGAeGiLsnDGg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi all,
On Thu, Sep 17, 2026 at 3:07 PM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> Hi Surya,
>
> On 31 Aug 2026, Surya Poondla wrote:
> > Could it be gated on there actually being an older timeline to abandon,
> > i.e. only when the eligible entry isn't the last in expectedTLEs?
>
> Thank you for the review. PFA v4.
>
> I first made "not searching older timelines for WAL segment" a
> throttled LOG message. Looking at the result, however, it reports an
> action recovery deliberately does not take. On reconsideration, it is
> better left as a DEBUG1 diagnostic used by the tests. The tests enable
> DEBUG1, while normal recovery logs remain unchanged. I also separated
> xlogfname from path as suggested and renumbered the tests to 057/058.
>
> Thank you!
>
I reviewed the v4 patch and applied the patch cleanly on the current
master and built PostgreSQL successfully. Verified complete recovery
TAP test suite, Ran new regression tests like
057_timeline_switch_archive_divergence.pl &
058_timeline_switch_intermediate_tl.pl and passed successfully.
Validated both the direct timeline-switch divergence case and the
intermediate case. I also reviewed the change in XLogFileReadAnyTLI().
The new logic correctly stops searching older timelines once the
newest eligible timeline for the requested WAL segment has been
reached, preventing recovery from falling back to a divergent
parent-timeline segment when the required segment on the newer
timeline is unavailable. The updated comment also clearly explains why
the complete segment must be read from the eligible timeline, even
though the prefix of a switch-point segment may be valid on the parent
timeline.
Overall, the patch looks good to me.
Regards
Solai
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vaibhav Dalvi | 2026-09-18 06:37:26 | Re: gist_trgm_ops '=' operator: planner picks it over btree, ~300x slower |
| Previous Message | Henson Choi | 2026-09-18 05:53:09 | Re: Row pattern recognition |