Re: Typo in README.barrier

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Typo in README.barrier
Date: 2021-05-16 12:51:50
Message-ID: CAApHDvr=WODpYNjvZ0KVm3v-inN0XYoHSuwSzM4O9=_qFS65gQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 17 May 2021 at 00:11, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> wrote:
> I think there is a typo in src/backend/storage/lmgr/README.barrier.
> Attached patch should fix it.

Yeah looks like a typo to me.

I wonder if we also need to fix this part:

> either one does their writes. Eventually we might be able to use an atomic
> fetch-and-add instruction for this specific case on architectures that support
> it, but we can't rely on that being available everywhere, and we currently
> have no support for it at all. Use a lock.

That seems to have been written at a time before we got atomics.

The following also might want to mention atomics too:

> 2. Eight-byte loads and stores aren't necessarily atomic. We assume in
> various places in the source code that an aligned four-byte load or store is
> atomic, and that other processes therefore won't see a half-set value.
> Sadly, the same can't be said for eight-byte value: on some platforms, an
> aligned eight-byte load or store will generate two four-byte operations. If
> you need an atomic eight-byte read or write, you must make it atomic with a
> lock.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Phil Godfrin 2021-05-16 12:57:01 FDW and connections
Previous Message Julien Rouhaud 2021-05-16 12:39:33 Re: compute_query_id and pg_stat_statements