BUG #18728: Inconsistency between pg_wait_events.name and pg_stat_activity.wait_event for LWLocks

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: christophe(dot)courtois(at)dalibo(dot)com
Subject: BUG #18728: Inconsistency between pg_wait_events.name and pg_stat_activity.wait_event for LWLocks
Date: 2024-11-27 18:15:20
Message-ID: 18728-450924477056a339@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18728
Logged by: Christophe Courtois
Email address: christophe(dot)courtois(at)dalibo(dot)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.

If it cannot be improved, I suggest that the query at the end of
https://www.postgresql.org/docs/17/monitoring-stats.html#WAIT-EVENT-ACTIVITY-TABLE
should use "LEFT OUTER JOIN pg_waits_events", to avoid removing lines.

Thanks,

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-11-27 18:17:18 Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails
Previous Message Nathan Bossart 2024-11-27 18:12:10 Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails