Re: Exceptional md.c paths for recovery and zero_damaged_pages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Exceptional md.c paths for recovery and zero_damaged_pages
Date: 2024-12-14 00:06:16
Message-ID: 1272696.1734134776@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> We have a fair number of special paths in md.c that are specific to
> recovery. E.g. in mdreadv() we do:
> ...
> As far as I can tell, nearly all - including the above - InRecovery paths in
> md.c are basically unreachable. And have been for quite a while.

> XLogReadBufferExtended() takes care to
> a) Create the fork if it doesn't yet exist.
> b) Not to read from beyond EOF. If EOF is found, we extend the relation to be
> large enough.
> Which afaict should suffice to prevent needing the above?

I haven't checked the git history, but I suspect this logic is later
than the md.c code you mention, and may well render it obsolete.

> The InRecovery paths for _mdfd_getseg seem to originate in 2004's 303e46ea932
> and the zero-beyond-eof seems to be from 2007's ef07221997e - although it was
> just *restricted* to InRecovery in that commit.

We definitely needed 303e46ea932 at the time, but that doesn't mean
we still do. Possibly ef07221997e was just copying the earlier logic.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-12-14 00:06:53 Re: Recovering from detoast-related catcache invalidations
Previous Message Tom Lane 2024-12-13 23:57:52 Re: Added schema level support for publication.