On Mon, 12 Oct 2026 at 11:23, Bertrand Drouvot <[email protected]> wrote: > === 1 > > pg_atomic_read_membarrier_u64() is documented to return the current value when > updates use operations with barrier semantics, while > IncrementXactCompletionCount() > uses pg_atomic_write_u64(). > > IIUC, this is safe because the counter update is followed by the full barrier > LWLockRelease(ProcArrayLock).
Correct. > I could not find another place relying on such a > pairing though: existing callers use barrier semantic writes. > > Worth documenting this explicitly? Done. > === 2 > > As pg_atomic_read_membarrier_u64() is potentially more expensive than > pg_atomic_read_u64() then, what about keeping pg_atomic_read_membarrier_u64() > at xmin_installed, but using pg_atomic_read_u64() for the first read? Every > successful reuse passes through xmin_installed, so the second read is the > final > validation. Good point. Patch 0003 has been adjusted to only issue the membarrier read after installing a new xmin. The xmin-installed path now doesn't issue any membarriers. Attached is v3, which is a rebase onto head with the two issues that Bertrand raised addressed. Kind regards, Matthias van de Meent Databricks (https://www.databricks.com)
v3-0001-Split-out-TransamVariablesData-from-transam.h.patch
Description: Binary data
v3-0002-procarray-Implement-optimistic-lockless-snapshot-.patch
Description: Binary data
v3-0003-procarray-Implement-full-lockless-snapshot-reuse.patch
Description: Binary data
