> I think the smallest fix here would be to change CheckPointPredicate()
> so that if tailPage > headPage, pass headPage to SimpleLruTruncate()
> instead of tailPage. Or perhaps it should go into the "The SLRU is no
> longer needed" codepath in that case. If tailPage > headPage, the SLRU
> isn't needed at the moment.
I spent sometime studying this and it appears to be a good approach.
Passing the cutoff page as headPage (SLRU not needed code path ) instead of the tailPage to
SimpleLruTruncate is already being done when the tailXid is not a valid XID.
I added an additional condition to make sure that the tailPage proceeds the headPage
as well.
Attached is v2 of the patch.
> In addition to that, we could change SerialAdd() to not zero out the
> pages between old headXid and tailXid unnecessarily, but that's more of
> an optimization than bug fix.
Yes, I did notice that in my debugging, but will not address this in the current patch.
Regards,
Sami