Re: corruption of WAL page header is never reported
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: masao.fujii@oss.nttdata.com, nagata@sraoss.co.jp, ranier.vf@gmail.com, pgsql-hackers@postgresql.org
Date: 2021-09-05T18:11:13Z
Lists: pgsql-hackers
On 2021-Sep-03, Kyotaro Horiguchi wrote: > diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c > index 24165ab03e..b621ad6b0f 100644 > --- a/src/backend/access/transam/xlog.c > +++ b/src/backend/access/transam/xlog.c > @@ -12496,9 +12496,21 @@ retry: > * > * Validating the page header is cheap enough that doing it twice > * shouldn't be a big deal from a performance point of view. > + * > + * Don't call XLogReaderValidatePageHeader here while not in standby mode > + * so that this function won't return with a valid errmsg_buf. > */ > - if (!XLogReaderValidatePageHeader(xlogreader, targetPagePtr, readBuf)) > + if (StandbyMode && > + !XLogReaderValidatePageHeader(xlogreader, targetPagePtr, readBuf)) OK, but I don't understand why we have a comment that says (referring to non-standby mode) "doing it twice shouldn't be a big deal", followed by "Don't do it twice while not in standby mode" -- that seems quite contradictory. I think the new comment should overwrite the previous one, something like this: - * Validating the page header is cheap enough that doing it twice - * shouldn't be a big deal from a performance point of view. + * + * We do this in standby mode only, + * so that this function won't return with a valid errmsg_buf. */ - if (!XLogReaderValidatePageHeader(xlogreader, targetPagePtr, readBuf)) + if (StandbyMode && + !XLogReaderValidatePageHeader(xlogreader, targetPagePtr, readBuf)) -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/
Commits
-
Make recovery report error message when invalid page header is found.
- 7b03d3a3ba45 12.17 landed
- 5dc093eacef1 13.13 landed
- 2f13e8d9ec28 14.10 landed
- 68601985e699 15.0 landed
-
Fix scenario where streaming standby gets stuck at a continuation record.
- 066871980183 11.0 cited