Do sys logger and stats collector need wait events WAIT_EVENT_SYSLOGGER_MAIN/_PGSTAT_MAIN?
Hi,
Although the pg_stat_activity has no entry for the sys logger and
stats collector (because of no shared memory access), the wait events
WAIT_EVENT_SYSLOGGER_MAIN and WAIT_EVENT_PGSTAT_MAIN are defined. They
seem to be unnecessary. Passing 0 or some other undefined wait event
value to the existing calls of WaitLatch and WaitLatchOrSocket instead
of WAIT_EVENT_SYSLOGGER_MAIN/WAIT_EVENT_PGSTAT_MAIN, would work. We
can delete these wait events and their info from pgstat.c.
I'm sure this is not so critical, but I'm just checking if someone
feels that they should be removed or have some other reasons for
keeping them.
Thoughts?
Regards,
Bharath Rupireddy.
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> writes:
Although the pg_stat_activity has no entry for the sys logger and
stats collector (because of no shared memory access), the wait events
WAIT_EVENT_SYSLOGGER_MAIN and WAIT_EVENT_PGSTAT_MAIN are defined. They
seem to be unnecessary. Passing 0 or some other undefined wait event
value to the existing calls of WaitLatch and WaitLatchOrSocket instead
of WAIT_EVENT_SYSLOGGER_MAIN/WAIT_EVENT_PGSTAT_MAIN, would work. We
can delete these wait events and their info from pgstat.c.
Well ... mumble. The fact that these events are defined would lead
people to wonder why they're not hit, so there's a documentation reason
to get rid of them. However, I quite dislike the suggestion of "just
pass zero"; that will probably draw compiler warnings, or if it doesn't
it should. We'd have to invent some other "unused" wait event, and
then it's not clear that we've made any gain in intelligibility.
On the whole I'd be inclined to leave it alone. Even if the reporting
mechanisms aren't able to report these events today, maybe they'll
be able to do so in future. The context of the stats collector
process, in particular, seems likely to change.
regards, tom lane
On Fri, Dec 03, 2021 at 12:42:47PM -0500, Tom Lane wrote:
On the whole I'd be inclined to leave it alone. Even if the reporting
mechanisms aren't able to report these events today, maybe they'll
be able to do so in future. The context of the stats collector
process, in particular, seems likely to change.
These come from 6f3bd98, where I am pretty sure that I (or Robert)
defined those values to not have users guess what to pass down to
WaitLatch(), assuming that this may become useful in the future. So
I'd rather leave them be.
--
Michael