Re: pgsql: Add pg_atomic_unlocked_write_u64

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Add pg_atomic_unlocked_write_u64
Date: 2025-12-04 16:03:22
Message-ID: aTGwysvF2lDmK2lP@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Thu, Dec 04, 2025 at 10:56:12AM -0500, Andres Freund wrote:
> The whole point of the _unlocked_ function is to use it for modifying an
> atomic that doesn't need to actually be atomic when modified by that
> function. The current use-case for it is to to modify BufferDesc->state for
> temporary table buffers. Those obviously can't be shared across processes and
> therefore don't need an atomic operation to be modified. In the referenced
> thread I'm working on converting BufferDesc->state to be a 64bit atomic, hence
> the need for pg_atomic_unlocked_write_u64().
>
> I didn't notice that the comment for pg_atomic_unlocked_write_u32() makes that
> claim about partial writes not being visible. I think we should just remove
> that claim.

+1 to updating the comment with this context.

--
nathan

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-12-04 17:12:57 pgsql: amcheck: Fix snapshot usage in bt_index_parent_check
Previous Message Andres Freund 2025-12-04 15:56:12 Re: pgsql: Add pg_atomic_unlocked_write_u64

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2025-12-04 16:03:44 Re: Segmentation fault on proc exit after dshash_find_or_insert
Previous Message Andres Freund 2025-12-04 15:56:12 Re: pgsql: Add pg_atomic_unlocked_write_u64