Re: POC: Unlocked path for GetSnapshotDataReuse

From: Andres Freund <andres(at)anarazel(dot)de>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: POC: Unlocked path for GetSnapshotDataReuse
Date: 2026-10-09 12:54:04
Message-ID: rpf3opp3uexuz37erhq6fif662xob3t7ewbxjkjifkirubloaq@vjwseeum7kns
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2026-10-09 13:08:43 Re: use indnkeyatts not indnatts in loops that read rd_indcollation
Previous Message Andres Freund 2026-10-09 12:49:48 Re: POC: Unlocked path for GetSnapshotDataReuse