pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pgstat: split different types of stats into separate files.
Date: Mon, 21 Mar 2022 19:06:06 +0000
Message-ID: <E1nWNLx-000kz9-Nt@gemulon.postgresql.org> (raw)

pgstat: split different types of stats into separate files.

pgstat.c is very long, and it's hard to find an order that makes sense and is
likely to be maintained over time. Splitting the different pieces into
separate files makes that a lot easier.

With a few exceptions, this commit just moves code around. Those exceptions
are:
- adding file headers for new files
- removing 'static' from functions
- adapting pgstat_assert_is_up() to work across TUs
- minor comment adjustments
git diff --color-moved=dimmed-zebra is very helpful separating code movement
from code changes.

The next commit in this series will reorder pgstat.[ch] contents to be a bit
more coherent.

Earlier revisions of this patch had "global" statistics (archiver, bgwriter,
checkpointer, replication slots, SLRU, WAL) in one file, because each seemed
small enough. However later commits will increase their size and their
aggregate size is not insubstantial. It also just seems easier to split each
type of statistic into its own file.

Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/13619598f1080d7923454634a2570ca1bc0f2fec

Modified Files
--------------
src/backend/postmaster/pgstat.c                  | 2113 +---------------------
src/backend/utils/activity/Makefile              |   10 +
src/backend/utils/activity/pgstat_archiver.c     |   44 +
src/backend/utils/activity/pgstat_bgwriter.c     |   63 +
src/backend/utils/activity/pgstat_checkpointer.c |   61 +
src/backend/utils/activity/pgstat_database.c     |  279 +++
src/backend/utils/activity/pgstat_function.c     |  225 +++
src/backend/utils/activity/pgstat_relation.c     |  935 ++++++++++
src/backend/utils/activity/pgstat_replslot.c     |  119 ++
src/backend/utils/activity/pgstat_slru.c         |  201 ++
src/backend/utils/activity/pgstat_subscription.c |   78 +
src/backend/utils/activity/pgstat_wal.c          |  159 ++
src/include/utils/pgstat_internal.h              |  161 ++
13 files changed, 2408 insertions(+), 2040 deletions(-)



Message-ID: <E1nWNLx-000kz9-Nt@gemulon.postgresql.org>
Permalink:  ../E1nWNLx-000kz9-Nt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nWNLx-000kz9-Nt@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: pgstat: split different types of stats into separate files.
  In-Reply-To: <E1nWNLx-000kz9-Nt@gemulon.postgresql.org>
  References: <E1nWNLx-000kz9-Nt@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox