Re: BUG #18728: Inconsistency between pg_wait_events.name and pg_stat_activity.wait_event for LWLocks - Mailing list pgsql-bugs

From Bertrand Drouvot
Subject Re: BUG #18728: Inconsistency between pg_wait_events.name and pg_stat_activity.wait_event for LWLocks
Date
Msg-id Z0hThk/ySU8ZeICy@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to BUG #18728: Inconsistency between pg_wait_events.name and pg_stat_activity.wait_event for LWLocks  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18728: Inconsistency between pg_wait_events.name and pg_stat_activity.wait_event for LWLocks
List pgsql-bugs
Hi,

On Wed, Nov 27, 2024 at 06:15:20PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      18728
> Logged by:          Christophe Courtois
> Email address:      christophe.courtois@dalibo.com
> PostgreSQL version: 17.2
> Operating system:   Linux (Debian 12)
> Description:        
> 
> Hi,
> When joining pg_stat_activity and pg_wait_events, I've found discrepancies
> with wait_event names.
> 
> I have launched a pgbench and run this repeatedly:
> 
> SELECT distinct wait_event, wait_event_type, w.name, w.description
> FROM pg_stat_activity LEFT JOIN pg_wait_events w ON (name=wait_event and
> w.type=wait_event_type) order by 1,2 ;
> 
> And I got these lines without description, among correct ones with a
> description.
> 
>      wait_event      | wait_event_type |        name         |              
>           description                          
>
---------------------+-----------------+---------------------+--------------------------------------------------------------
> ...
>  WALWriteLock        | LWLock          | ø                   | ø
>  SerializableXactHashLock | LWLock          | ø                   | ø
>  SerializableFinishedListLock | LWLock          | ø                    | ø
>  ProcArrayLock       | LWLock          | ø                   | ø
> 
> pg_wait_events.name does contain WALWrite, SerializableXactHash,
> SerializableFinishedList or
>  ProcArray, but not WALWriteLock, SerializableXactHashLock,
> SerializableFinishedListLock, ProcArrayLock.
> 
> If I understand correctly, the names of LWLocks are defined in
> src/include/storage/lwlocklist.h, and the PG_LWLOCK macro adds 'Lock'
> (lwlock.c) ; while the doc and pg_wait_events are generated from the content
> of src/backend/utils/activity/wait_event_names.txt, that does not contain
> the 'Lock' suffix.

Thanks for the report!

Yeah, LWLock are displayed as <wait_event>Lock in pg_stat_activity
while mentioned as <wait_event> in the doc (and so in pg_wait_events).

From what I can see, the issue has been introduced in da952b415f that added
back the "Lock" suffix into the LWLock wait event names. I'm saying "added back"
because the "Lock" suffix was removed in 14a9101091.

I looked at the thread ([1]) that lead to da952b415f and I don't see that the
intention was to "revert" 14a9101091.

So, it seems to me that the thing to do would be to remove the "Lock" suffix from 
the LWLock wait event names.

Adding Álvaro in the loop to get his thoughts on it.

Regards,

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



pgsql-bugs by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails
Next
From: Vladyslav Hutych
Date:
Subject: Dropping partition with CASCADE drops constraints on partitioned table