Re: corruption of WAL page header is never reported

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: nagata(at)sraoss(dot)co(dot)jp, ranier(dot)vf(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: corruption of WAL page header is never reported
Date: 2021-09-02 05:44:31
Message-ID: 8370e15f-92a3-1065-77f3-9ab2aee3f9a3@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/09/02 13:17, Kyotaro Horiguchi wrote:
> Did you read the comment just above?

Yes!

>
> xlog.c:12523
>> * Check the page header immediately, so that we can retry immediately if
>> * it's not valid. This may seem unnecessary, because XLogReadRecord()
>> * validates the page header anyway, and would propagate the failure up to
>> * ReadRecord(), which would retry. However, there's a corner case with
>> * continuation records, if a record is split across two pages such that
>
> So when not in standby mode, the same check is performed by xlogreader
> which has the responsibility to validate the binary data read by
> XLogPageRead. The page-header validation is a compromise to save a
> specific case.

Yes, so XLogPageRead() can skip the validation check of page head if not
in standby mode. On the other hand, there is no problem if it still performs
the validation check as it does for now. No?

> I don't think it is good choice to conflate read-failure and header
> validation failure from the view of modularity.

I don't think that the proposed change does that. But maybe I failed to get
your point yet... Anyway the proposed change just tries to reset
errormsg_buf whenever XLogPageRead() retries, whatever error happened
before. Also if errormsg_buf is set at that moment, it's reported.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-09-02 05:45:54 Re: pg_receivewal starting position
Previous Message Amit Kapila 2021-09-02 05:36:28 Re: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)