Prevent walsummarizer from getting stuck at a timeline switch.

As previously coded, walsummarizer only wants to read WAL from a file
where the TimeLineID in the filename exactly matches the TimeLineID being
summarized. But in some cases, when a timeline switch occurs, the WAL file
from the old timeline is not archived, because it's never completely
filled, so the only way to obtain the contents of that last partial
segment is to read from the first segment on the new timeline. Teach
WAL summarizer to do that, and add a test case to make sure that it
works.

Reported-by: Nick Ivanov <[email protected]>
Reviewed-by: Andrey Borodin <[email protected]>
Tested-by: Amit Kapila <[email protected]>
Reviewed-by: Srinath Reddy Sadipiralla <[email protected]>
Reviewed-by: Zhijie Hou <[email protected]>
Reviewed-by: Thom Brown <[email protected]>
Discussion: 
http://postgr.es/m/ca+tgmobr27gpkdzx3_ezw2+c5_g18i+jsk3sgf_cr-_esv5...@mail.gmail.com
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3e8a0c1b02c3d8b96cd5febacab8aaba4869431f

Modified Files
--------------
src/backend/postmaster/walsummarizer.c    | 173 +++++++++++++++++++++++++++---
src/bin/pg_walsummary/meson.build         |   1 +
src/bin/pg_walsummary/t/003_tli_switch.pl | 146 +++++++++++++++++++++++++
3 files changed, 306 insertions(+), 14 deletions(-)

Reply via email to