Reporting wait events for system processes

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Reporting wait events for system processes
Date: 2016-10-13 06:46:18
Message-ID: CAB7nPqSYN05rGsYCTahxTz+2hBikh7=m+hr2JTXaZv_Ei=qJAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I have been looking at the possibility to support wait events for
system processes, and here are the things that I think need to be
done:
- System processes do not have PGPROC entries in PROC_HDR. I think
that we should add an array for system processes, putting in it
walwriterLatch, checkpointerLatch and startupProc at the same time
because we'd store directly a PGPROC entry. Another possibility would
be to declare them individually in PROC_HDR, but I'd like to have a
routine like BackendPidGetProc() but for system processes. And that is
more portable in the long run.
- System process PIDs are not reported as global variables. So we
would need to move them from postmaster.c to globals.c and declare
them as global variables. Those are now just static variables in
postmaster.c. This is useful to match those PIDs with the entries in
PGPROC_HDR to get the names of each process.
- The catalog associated to system processes has this shape:
-- name - name of the process, walreceiver, autovacuum, bgworker,
autovacuum_worker, startup etc.
-- PID
-- wait_event
-- wait_event_type
I think that it would be fine to name it, say pg_stat_system_activity,
and to define it as a system view fed by a SRF function that scans the
arrays of PGPROC entries for background workers, autovacuum workers
and system processes.

Thoughts about that? I am expecting a couple of -1 for suggesting to
expose the system PIDs now only local to postmaster.c ;)

Thanks,
--
Michael

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mithun Cy 2016-10-13 07:00:59 Re: Patch: Implement failover on libpq connect level.
Previous Message Prabhat Sahu 2016-10-13 06:38:29 Re: Aggregate Push Down - Performing aggregation on foreign server