Re: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid

Xiaopeng Wang <wxp_728@163.com>

From: Xiaopeng Wang <wxp_728@163.com>
To: Fujii Masao <masao.fujii@gmail.com>, vignesh C <vignesh21@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-16T05:27:13Z
Lists: pgsql-hackers
在 2026/4/16 12:11, Fujii Masao 写道:
> On Mon, Apr 13, 2026 at 4:10 PM vignesh C <vignesh21@gmail.com> wrote:
>> I felt these also should be updated, the attached v2 version patch
>> includes the changes for the same.
> Thanks for updating the patch!
>
> -       applyPtr = (latestApplyPtr == InvalidXLogRecPtr) ?
> +       applyPtr = (XLogRecPtrIsInvalid(latestApplyPtr)) ?
>
> XLogRecPtrIsValid() should be used here, instead?
>
> Regards,
>

Yeah, I was about to raise the same comment, and Fujii-san beat me. I believe it should be XLogRecPtrIsValid().

Otherwise, the patch looks good to me.

Regards,
Xiaopeng Wang




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Use XLogRecPtrIsValid() consistently for WAL position checks

  2. Use XLogRecPtrIsValid() in various places