Re: pg_waldump error message fix - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_waldump error message fix
Date
Msg-id X9MB9fvSzIyD6K65@paquier.xyz
Whole thread Raw
In response to Re: pg_waldump error message fix  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: pg_waldump error message fix
List pgsql-hackers
On Fri, Dec 11, 2020 at 01:30:16PM +0900, Kyotaro Horiguchi wrote:
> currRecPtr is a private member of the struct (see the definition of
> the struct XLogReaderState).  We should instead use EndRecPtr outside
> xlog reader.

Please note that this is documented in xlogreader.h.  Hmm.  I can see
your point here, still I think that what both of you are suggesting
is not completely correct.  For example, switching to EndRecPtr would
cause DecodeXLogRecord() to report an error with the end of the
current record but it makes more sense to point to ReadRecPtr in this
case.  On the other hand, it would make sense to report the beginning
of the position we are working on when validating the header if an
error happens at this point.  So it seems to me that EndRecPtr or
ReadRecPtr are not completely correct, and that we may need an extra
LSN position to tell on which LSN we are working on instead that gets
updated before the validation part, because we update ReadRecPtr and
EndRecPtr only after this initial validation is done.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: pg_waldump error message fix
Next
From: Michael Paquier
Date:
Subject: Re: pg_shmem_allocations & documentation