Re: WAL Insertion Lock Improvements

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: WAL Insertion Lock Improvements
Date: 2023-05-19 15:04:16
Message-ID: CALj2ACVR+nxT1RQz25NrGMkoiRWspmYwdYybVdcBE7g6GjNj7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 19, 2023 at 12:24 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Thu, May 18, 2023 at 11:18:25AM +0530, Bharath Rupireddy wrote:
> > I think what I have so far seems more verbose explaining what a
> > barrier does and all that. I honestly think we don't need to be that
> > verbose, thanks to README.barrier.
>
> Agreed. This file is a mine of information.
>
> > I simplified those 2 comments as the following:
> >
> > * NB: pg_atomic_exchange_u64, having full barrier semantics will ensure
> > * the variable is updated before releasing the lock.
> >
> > * NB: pg_atomic_exchange_u64, having full barrier semantics will ensure
> > * the variable is updated before waking up waiters.
> >
> > Please find the attached v7 patch.
>
> Nit. These sentences seem to be worded a bit weirdly to me. How
> about:
> "pg_atomic_exchange_u64 has full barrier semantics, ensuring that the
> variable is updated before (releasing the lock|waking up waiters)."

I get it. How about the following similar to what
ProcessProcSignalBarrier() has?

+ * Note that pg_atomic_exchange_u64 is a full barrier, so we're guaranteed
+ * that the variable is updated before waking up waiters.
+ */

+ * Note that pg_atomic_exchange_u64 is a full barrier, so we're guaranteed
+ * that the variable is updated before releasing the lock.
*/

Please find the attached v8 patch with the above change.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v8-0001-Optimize-WAL-insertion-lock-acquisition-and-relea.patch application/octet-stream 8.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sehrope Sarkuni 2023-05-19 15:07:29 Re: PG 16 draft release notes ready
Previous Message Peter Eisentraut 2023-05-19 15:03:21 Re: smgrzeroextend clarification