Re: Consistently use the XLogRecPtrIsInvalid() macro

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Quan Zongliang <quanzongliang(at)yeah(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Consistently use the XLogRecPtrIsInvalid() macro
Date: 2025-11-13 14:11:08
Message-ID: aRXm/KnHlXAThWNf@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 07, 2025 at 02:37:32PM +0100, Álvaro Herrera wrote:

> Hmm, I tried to recreate your patch using this .cocci file, and in my
> run, there's a few changes in your patch that my spatch run didn't
> detect. I wonder if that's because my spatch version is buggy, or
> because you hacked the .cocci file beyond what's in your github repo.

spatch needs to be run with --recursive-includes (so that the .cocci script
is able to collect information from all the structs of interest). The header
comment in the .cocci script did not mention that: just fixed).

But then I realized that if I run spatch that way:

spatch --sp-file replace_literal_0_assignement_with_InvalidXLogRecPtr.cocci \
--dir /path/to/postgres/src \
-I /path/to/postgres/src/include \
--recursive-includes \
> replace.patch

Then some headers were not included (no clue as to why). But if I run spatch on
the .c files one by one with the --recursive-includes then it works (i.e all
the headers of interest are included).

So, I created [1] to run spatch one by one on all the .c files (in parallel).

To produce the patch that I shared I ran:

./run_parallel.sh /absolute_path_to/replace_literal_0_assignement_with_InvalidXLogRecPtr.cocci -j 32

(patch can be found in /path/to/postgres once completed).

> (I'm wondering if I should reproduce your previous patches in case there
> were also differences there. Life is short though.)

I guess/hope you'll get the same results if you use run_parallel.sh as mentioned
above.

[1]: https://github.com/bdrouvot/coccinelle_on_pg/blob/main/wrappers/run_parallel.sh

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matheus Alcantara 2025-11-13 14:36:09 Re: Include extension path on pg_available_extensions
Previous Message Jonathan S. Katz 2025-11-13 14:02:35 Re: 2025-11-13 release announcement draft