Re: shared-memory based stats collector - v70 - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: shared-memory based stats collector - v70
Date
Msg-id 20220810.113910.92411510444435201.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: shared-memory based stats collector - v70  (Andres Freund <andres@anarazel.de>)
Responses Re: shared-memory based stats collector - v70
List pgsql-hackers
At Tue, 9 Aug 2022 09:53:19 -0700, Andres Freund <andres@anarazel.de> wrote in 
> Hi,
> 
> On 2022-08-09 17:24:35 +0900, Kyotaro Horiguchi wrote:
> > If I'm not missing something, it's strange that pgstat_lock_entry()
> > only takes LW_EXCLUSIVE.
> 
> I think it makes some sense, given that there's a larger number of callers for
> that in various stats-emitting code. Perhaps we could just add a separate
> function with a _shared() suffix?

Sure. That was an alternative I had in my mind.

> > The atached changes the interface of
> > pgstat_lock_entry() but there's only one user since another read of
> > shared stats entry is not using reference. Thus the interface change
> > might be too much. If I just add bare LWLockAcquire/Release() to
> > pgstat_fetch_entry,the amount of the patch will be reduced.
> 
> Could you try the pgstat_lock_entry_shared() approach?

Of course. Please find the attached.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: hash_xlog_split_allocate_page: failed to acquire cleanup lock
Next
From: Mark Dilger
Date:
Subject: Re: hash_xlog_split_allocate_page: failed to acquire cleanup lock