Обсуждение: "duplicated" wait events

Поиск
Список
Период
Сортировка

"duplicated" wait events

От
"Drouvot, Bertrand"
Дата:
Hi hackers,

while working on the new system catalog pg_wait_event (see [1]) I noticed that some wait
events are currently "duplicated":

postgres=# select wait_event_name,count(*) from pg_wait_event group by wait_event_name having count(*) > 1;
  wait_event_name | count
-----------------+-------
  SyncRep         |     2
  WALWrite        |     2
(2 rows)

Indeed:

SynRep currently appears in "IPC" and "LWLock" (see [2])
WALWrite currently appears in "IO" and "LWLock" (see [2])

I think that can lead to confusion and it would be better to avoid duplicate wait event
name across Wait Class (and so fix those 2 ones above), what do you think?

[1]: https://www.postgresql.org/message-id/0e2ae164-dc89-03c3-cf7f-de86378053ac%40gmail.com
[2]: https://www.postgresql.org/docs/current/monitoring-stats.html

Regards,

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



Re: "duplicated" wait events

От
Kyotaro Horiguchi
Дата:
At Fri, 4 Aug 2023 17:07:51 +0200, "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> wrote in 
> SynRep currently appears in "IPC" and "LWLock" (see [2])
> WALWrite currently appears in "IO" and "LWLock" (see [2])
> 
> I think that can lead to confusion and it would be better to avoid
> duplicate wait event
> name across Wait Class (and so fix those 2 ones above), what do you
> think?

I think it would be handy to be able to summirize wait events by event
names, instead of classes. In other words, grouping wait events
through all classes according to their purpose. From that perspective,
I'm rather fan of consolidating event names (that is, the opposite of
your proposal).

However, it seems the event weren't named with this consideration. So
I'm on the fence about this change.


By the way, I couldn't figure out how to tag event names without
messing up the source tree. This causes meson to refuse a build..

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



Re: "duplicated" wait events

От
"Drouvot, Bertrand"
Дата:
Hi,

On 8/7/23 7:46 AM, Kyotaro Horiguchi wrote:
> At Fri, 4 Aug 2023 17:07:51 +0200, "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> wrote in
>> SynRep currently appears in "IPC" and "LWLock" (see [2])
>> WALWrite currently appears in "IO" and "LWLock" (see [2])
>>
>> I think that can lead to confusion and it would be better to avoid
>> duplicate wait event
>> name across Wait Class (and so fix those 2 ones above), what do you
>> think?
> 
> I think it would be handy to be able to summirize wait events by event
> names, instead of classes. In other words, grouping wait events
> through all classes according to their purpose. From that perspective,
> I'm rather fan of consolidating event names (that is, the opposite of
> your proposal).
> 

I could agree if they had the same descriptions and behaviors.

For example with WALWrite:

WALWrite in "IO" is described as "Waiting for a write to a WAL file" and
is described in "LWLock" as "Waiting for WAL buffers to be written to disk".
Having two distinct descriptions seems to suggest the wait events are not the same.

Also I think it makes sense to distinguish both as the LWLock one could
be reported as waiting in LWLockReportWaitStart() while trying to grab the
lock in LW_SHARED mode (as done in GetLastSegSwitchData()).

I think there is 2 things to address:

1) fix the current duplicates
2) put safeguard in place

As far 1), it could be easily done by updating wait_event_names.txt (renaming duplicates)
in the master branch. As the duplication has been introduced in 14a9101091
(so starting as of PG 13) we would need to update monitoring.sgml for <= 16 should we want to
back patch.

2) could be handled in generate-wait_event_types.pl on master.

Regards,

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