Re: Do away with zero-padding assumption before WALRead() - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Do away with zero-padding assumption before WALRead()
Date
Msg-id CALj2ACVbYa309nvR-sGPX+bWOfn=jT5nw1nF2fna9MJBbtX2OA@mail.gmail.com
Whole thread Raw
In response to Re: Do away with zero-padding assumption before WALRead()  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Do away with zero-padding assumption before WALRead()
List pgsql-hackers
On Mon, Feb 19, 2024 at 8:26 AM Kyotaro Horiguchi
<horikyota.ntt@gmail.com> wrote:
>
> On
> the flip side, SimpleXLogPageRead always reads a whole page and
> returns XLOG_BLCKSZ. However, as you know, the returned buffer doesn't
> contain random garbage bytes.

Is this assumption true when wal_init_zero is off? I think when
wal_init_zero is off, the last few bytes of the last page from the WAL
file may contain garbage bytes i.e. not zero bytes, no?

> Therefore, it's safe as long as the
> caller doesn't access beyond the returned count. As a result, the
> description you pointed out seems to be enough.

Right.

> After all, the patch looks good to me.

Thanks. It was committed -
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=73f0a1326608ac3a7d390706fdeec59fe4dc42c0.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: A new message seems missing a punctuation
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: A new message seems missing a punctuation