| From: | vignesh C <vignesh21(at)gmail(dot)com> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Use XLogRecPtrIsValid() instead of negated XLogRecPtrIsInvalid |
| Date: | 2026-04-13 07:10:06 |
| Message-ID: | CALDaNm0zJuUon52OEx5SpMoP8LEGJh+=PyYqwmcD7Zh97_dnJg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, 10 Apr 2026 at 20:16, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Fri, Apr 10, 2026 at 3:11 PM vignesh C <vignesh21(at)gmail(dot)com> 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?
I felt these also should be updated, the attached v2 version patch
includes the changes for the same.
Regards,
Vignesh
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-Use-XLogRecPtr-validity-helper-macros-consistentl.patch | application/octet-stream | 2.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-04-13 07:21:05 | Re: Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value) |
| Previous Message | Yugo Nagata | 2026-04-13 07:04:05 | Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0 |