Hi Fujii,
+1 to commit this patch first.
It does not cover one more case. If the recovery target is not at a
checkpoint redo, a timeline 1 summary can go past the switch point,
and a truncation after that point still drops blocks. This is the
case from the "Assertion failure in WAL summarizer" thread [1], and
Manu's 0002 there fixes it on top of this patch.
[1] https://postgr.es/m/179296590548.3326877.13182798945037392623@gmail.com
Thanks,
Shihao