Re: Improve LWLock tranche name visibility across backends

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve LWLock tranche name visibility across backends
Date: 2025-08-04 16:32:19
Message-ID: CAA5RZ0s0E52W_k53njwHCQN6tXE_FkOH705brXRo7D2hYcQ46Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > > I think we could add a local backend copy that stays up to date with the
> > > DSA. One idea would be to use an atomic counter to track the number of
> > > entries in the DSA and compare it with a local backend counter whenever the
> > > tranche name lookup occurs. If the atomic counter is higher (since we
> > > don't have deletions),
> > > we can update the local copy. Updating the local table should be a
> > > rare occurrence, but it would
> > > require an additional atomic fetch every time the name lookup occurs, in all the
> > > above code paths.
> > >
> > > Perhaps there's a better approach?
> >
> > I was thinking to switch to the DSA (and update local copy) when a name is
> > not found in the local copy. That way there is no need to maintain a counter and
> > the DSA overhead should be rare enough.
> >
> > Regards,
>
> That should work as well. good idea.

With a local hash table, I don't think it's necessary to introduce new
code for managing
a DSA based list of tranche names as is done in v3. We can go back to
storing the shared
trance names in dshash.

What do you think?

--
Sami

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ken Marshall 2025-08-04 16:55:07 Re: GB18030-2022 Support in PostgreSQL
Previous Message Dean Rasheed 2025-08-04 15:47:37 Re: Typo in create_index regression test