public inbox for [email protected]
help / color / mirror / Atom feedFrom: Fujii Masao <[email protected]>
To: vignesh C <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid
Date: Fri, 10 Apr 2026 23:46:39 +0900
Message-ID: <CAHGQGwEuEd2StEYuP9vj+jCFT=hQbX8xcQeq8=Kj8r9xT3vmyg@mail.gmail.com> (raw)
In-Reply-To: <CALDaNm16knMFtcqyAG3XYSkyagmVXfhaR0T=hau8UTAU0+eLQQ@mail.gmail.com>
References: <CALDaNm16knMFtcqyAG3XYSkyagmVXfhaR0T=hau8UTAU0+eLQQ@mail.gmail.com>
On Fri, Apr 10, 2026 at 3:11 PM vignesh C <[email protected]> wrote:
>
> Hi,
>
> This small cleanup patch updates src/bin/pg_waldump/archive_waldump.c
> to use the recently introduced XLogRecPtrIsValid() helper instead of
> negating XLogRecPtrIsInvalid(). The current code uses double-negative
> checks such as:
> Assert(!XLogRecPtrIsInvalid(privateInfo->startptr));
> if (!XLogRecPtrIsInvalid(privateInfo->endptr))
>
> This patch changes them to:
> Assert(XLogRecPtrIsValid(privateInfo->startptr));
> if (XLogRecPtrIsValid(privateInfo->endptr))
>
> This improves readability without changing behavior. The attached
> patch has the changes for the same.
Commit a2b02293bc6 switched various places to use XLogRecPtrIsValid(),
but it looks like later commits accidentally introduced uses of
XLogRecPtrIsInvalid() again. So +1 for this change.
Also, that commit replaced direct comparisons with InvalidXLogRecPtr with
XLogRecPtrIsValid(). I noticed two such comparisons [1]. Should these be
updated as well?
Regards,
[1]
$ git grep -E "[=\!]= InvalidXLogRecPtr"
src/backend/commands/repack_worker.c: Assert(ctx->reader->EndRecPtr
!= InvalidXLogRecPtr);
src/backend/replication/walreceiver.c: applyPtr = (latestApplyPtr ==
InvalidXLogRecPtr) ?
--
Fujii Masao
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid
In-Reply-To: <CAHGQGwEuEd2StEYuP9vj+jCFT=hQbX8xcQeq8=Kj8r9xT3vmyg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox