Tom Lane <t...@sss.pgh.pa.us> wrote:

> Antonin Houska <a...@cybertec.at> writes:
> > Tom Lane <t...@sss.pgh.pa.us> wrote:
> >> At one time, I think, readLen told how much data in readBuf was
> >> actually valid.  It seems not to be used for that anymore, but
> >> I don't much like the idea that readBuf is only partially filled
> >> but there is *no* persistent state indicating how much is valid.
> >> The existing coding guarantees that the answer is "XLOG_BLCKSZ",
> >> so that's fine, but this change would remove the guarantee.
> 
> Oh, I withdraw that complaint --- readBuf isn't a persistent data
> structure anymore, so there's no need for readLen to be persistent
> either.

Well, there's yet a problem. Your concern about invalid data in readBuf
reminded me of a problem that I reported a few years ago [1]. The problem is
hidden as long as all XLOG reader callbacks fetch the whole page.

However if readLen is used as an argument of read() in XLogPageRead() *and* if
some other conditions that also hide the issue are removed (see [2]), the
problem reported in [1] appears to be a live bug.

[1] https://www.postgresql.org/message-id/2363.1428573952%40localhost

[2] https://www.postgresql.org/message-id/32276.1516290849%40localhost

-- 
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com

Reply via email to