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