Re: POC: Unlocked path for GetSnapshotDataReuse - Mailing list pgsql-hackers

From Andres Freund
Subject Re: POC: Unlocked path for GetSnapshotDataReuse
Date
Msg-id rpf3opp3uexuz37erhq6fif662xob3t7ewbxjkjifkirubloaq@vjwseeum7kns
Whole thread
In response to Re: POC: Unlocked path for GetSnapshotDataReuse  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
Hi,

On 2026-10-09 05:57:52 +0000, Bertrand Drouvot wrote:
> +  pg_memory_barrier();
> +
> +  completions = pg_atomic_read_u64(&TransamVariables->xactCompletionCount);
> 
> IIUC, the barriers order the surrounding memory accesses, but they do not guarantee
> that pg_atomic_read_u64() does not return an old value.

I do not believe that that is true. Except in the sense of allowing an update
to the atomic variable having happened between pg_memory_barrier() and the
pg_atomic_read_u64(), but that's something that is indistinguishable from the
increment happening happeng just after pg_atomic_read_membarrier_u64().

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: POC: Unlocked path for GetSnapshotDataReuse
Next
From: Matthias van de Meent
Date:
Subject: Re: use indnkeyatts not indnatts in loops that read rd_indcollation