Re: Atomic ops for unlogged LSN - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Atomic ops for unlogged LSN
Date
Msg-id 20231107170249.GA782414@nathanxps13
Whole thread Raw
In response to Re: Atomic ops for unlogged LSN  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Atomic ops for unlogged LSN
List pgsql-hackers
On Tue, Nov 07, 2023 at 11:47:46AM -0500, Stephen Frost wrote:
> We only care about the value of the unlogged LSN being correct during
> normal shutdown when we're writing out the shutdown checkpoint, but by
> that time everything else has been shut down and the value absolutely
> should not be changing.

I agree that's all true.  I'm trying to connect how this scenario ensures
we see the most up-to-date value in light of this comment above
pg_atomic_read_u32():

 * The read is guaranteed to return a value as it has been written by this or
 * another process at some point in the past. There's however no cache
 * coherency interaction guaranteeing the value hasn't since been written to
 * again.

Is there something special about all other backends being shut down that
ensures this returns the most up-to-date value and not something from "some
point in the past" as the stated contract for this function seems to
suggest?

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: meson documentation build open issues
Next
From: Christoph Berg
Date:
Subject: Re: meson documentation build open issues