Subject: remove unnecessary volatile qualifiers

From: Nathan Bossart <[email-masked]>
Date: Tue, 30 Jun 2026 16:47:36 -0500

I looked into some of these earlier [0], but ended up leaving them alone at
the time.  Here is a new patch that removes all of the volatile markers in
the tree that seemed obviously unnecessary to me.

[0] https://postgr.es/m/aZX2oUcKf7IzHnnK%40nathan

-- 
nathan

---

From: Heikki Linnakangas <[email-masked]>
Date: Mon, 6 Jul 2026 14:58:12 +0300

> the tree that seemed obviously unnecessary to me.

Thanks!

> --- a/src/backend/access/transam/clog.c
> +++ b/src/backend/access/transam/clog.c
> @@ -450,7 +450,7 @@ static bool
>  TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
>  								XLogRecPtr lsn, int64 pageno)
>  {
> -	volatile PROC_HDR *procglobal = ProcGlobal;
> +	PROC_HDR   *procglobal = ProcGlobal;
>  	PGPROC	   *proc = MyProc;
>  	uint32		nextidx;
>  	uint32		wakeidx;

You might want to get rid of the local variable altogether and just 
refer to ProcGlobal directly..

> @@ -512,7 +512,7 @@ ProcessProcSignalBarrier(void)
>  {
>  	uint64		local_gen;
>  	uint64		shared_gen;
> -	volatile uint32 flags;
> +	uint32		flags;
>  
>  	Assert(MyProcSignalSlot);
>  

Are you sure about this one? 'flags' is used in the PG_TRY/CATCH block 
that follows. It is modified in the PG_TRY(), here:

> 
> 				/*
> 				 * To avoid an infinite loop, we must always unset the bit in
> 				 * flags.
> 				 */
> 				BARRIER_CLEAR_BIT(flags, type);

and read later in the PG_CATCH() block.

The rest looks OK to me.

- Heikki

---

From: Nathan Bossart <[email-masked]>
Date: Mon, 6 Jul 2026 10:47:03 -0500

>> the tree that seemed obviously unnecessary to me.

Thanks for reviewing.

> You might want to get rid of the local variable altogether and just refer to
> ProcGlobal directly..

Done.

> Are you sure about this one? 'flags' is used in the PG_TRY/CATCH block that
> follows. It is modified in the PG_TRY(), here:
> 
>> 
>> 				/*

Whoops.  You are right.  I reverted this part.

-- 
nathan

---

From: Nathan Bossart <[email-masked]>
Date: Tue, 7 Jul 2026 11:03:13 -0500

Committed.

-- 
nathan