Refactor statistics collector, backend status reporting and command progress reporting

From: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Refactor statistics collector, backend status reporting and command progress reporting
Date: 2022-03-01 18:12:02
Message-ID: CAMm1aWY-N+u7+=FZaVMS2ioaqezxj9wfSpoB5i+_jT-H4GDNtQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Following are the files related to PostgreSQL statistics collector,
backend status reporting and command progress reporting.

pgstat.[ch] - Definitions for the PostgreSQL statistics collector daemon.
backend_status.[ch] - Definitions related to backend status reporting.
backend_progress.[ch] - Definitions related to command progress reporting.
progress.h - Constants used with the progress reporting facilities
defined in backend_status.h
pgstatfuncs.c - Functions for accessing the statistics collector data

There is a scope for some refactoring here even though the backend
status and command progress related code is separated from pgstat.c.

1) There is a lot of confusion between progress.h and
backend_progress.h. Why 2 header files required for the same
functionality? I feel progress.h can be merged with
backend_progress.h.
2) The access functions related to statistics collector are included
in pgstatfuncs.c file. This also contains the access functions related
to backend status and backend progress. I feel the access function
related to backend status should go in backend_status.c and the access
functions related to backend progress should go in backend progress.c
file. If the size grows in future then we can create new files for
access functions (like backend_status_funcs.c and
backend_progress_funcs.c).
3) There is a dependency between backend status and command progress
reporting but the corresponding functions are separated into 2
different files. It is better to define a new structure named
'PgBackendProgress' in backend_progress.h which consists of
'st_progress_command', 'st_progress_command_target' and
'st_progress_param'. Include a variable of type 'PgBackendProgress' as
a member of 'PgBackendStatus' structure.

Please share your thoughts.
If required, I would like to work on the patch.

Thanks & Regards,
Nitin Jadhav

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-03-01 18:13:55 Re: CREATEROLE and role ownership hierarchies
Previous Message Thomas Munro 2022-03-01 17:46:23 Re: Checkpointer sync queue fills up / loops around pg_usleep() are bad