pgstat: rename some pgstat_send_* functions to pgstat_report_*.
authorAndres Freund <[email protected]>
Wed, 6 Apr 2022 21:08:57 +0000 (14:08 -0700)
committerAndres Freund <[email protected]>
Wed, 6 Apr 2022 21:08:57 +0000 (14:08 -0700)
Only the pgstat_send_* functions that are called from outside pgstat*.c are
renamed (the rest will go away). This is done separately from the - quite
large - shared memory statistics patch to make review easier.

Author: Andres Freund <[email protected]>
Reviewed-By: Kyotaro Horiguchi <[email protected]>
Discussion: https://postgr.es/m/20220404041516[email protected]

src/backend/postmaster/bgwriter.c
src/backend/postmaster/checkpointer.c
src/backend/postmaster/pgarch.c
src/backend/postmaster/pgstat.c
src/backend/postmaster/walwriter.c
src/backend/utils/activity/pgstat_archiver.c
src/backend/utils/activity/pgstat_bgwriter.c
src/backend/utils/activity/pgstat_checkpointer.c
src/backend/utils/activity/pgstat_wal.c
src/include/pgstat.h

index 447596b2a8b0126982d45e45d5769343c545011c..91e6f6ea18aad1a525273f5f40d1b6da42062978 100644 (file)
@@ -241,7 +241,7 @@ BackgroundWriterMain(void)
                can_hibernate = BgBufferSync(&wb_context);
 
                /* Report pending statistics to the cumulative stats system */
-               pgstat_send_bgwriter();
+               pgstat_report_bgwriter();
 
                if (FirstCallSinceLastCheckpoint())
                {
index 80914aa891c4c92bd6f3bb8b3baac4ae60b7432a..e733c70368a7883348ddaff03d0887b060e72687 100644 (file)
@@ -493,8 +493,8 @@ CheckpointerMain(void)
                CheckArchiveTimeout();
 
                /* Report pending statistics to the cumulative stats system */
-               pgstat_send_checkpointer();
-               pgstat_send_wal(true);
+               pgstat_report_checkpointer();
+               pgstat_report_wal(true);
 
                /*
                 * If any checkpoint flags have been set, redo the loop to handle the
@@ -571,8 +571,8 @@ HandleCheckpointerInterrupts(void)
                 */
                PendingCheckpointerStats.m_requested_checkpoints++;
                ShutdownXLOG(0, 0);
-               pgstat_send_checkpointer();
-               pgstat_send_wal(true);
+               pgstat_report_checkpointer();
+               pgstat_report_wal(true);
 
                /* Normal exit from the checkpointer is here */
                proc_exit(0);                   /* done */
@@ -715,7 +715,7 @@ CheckpointWriteDelay(int flags, double progress)
                CheckArchiveTimeout();
 
                /* Report interim statistics to the cumulative stats system */
-               pgstat_send_checkpointer();
+               pgstat_report_checkpointer();
 
                /*
                 * This sleep used to be connected to bgwriter_delay, typically 200ms.
index adfa404f4642a3f789009bf6ef6be2c31ff6cbae..0c8ca29f73d57b37fd2fc2a0887740b04f01415f 100644 (file)
@@ -480,7 +480,7 @@ pgarch_ArchiverCopyLoop(void)
                                 * Tell the cumulative stats system about the WAL file that we
                                 * successfully archived
                                 */
-                               pgstat_send_archiver(xlog, false);
+                               pgstat_report_archiver(xlog, false);
 
                                break;                  /* out of inner retry loop */
                        }
@@ -490,7 +490,7 @@ pgarch_ArchiverCopyLoop(void)
                                 * Tell the cumulative stats system about the WAL file that we
                                 * failed to archive
                                 */
-                               pgstat_send_archiver(xlog, true);
+                               pgstat_report_archiver(xlog, true);
 
                                if (++failures >= NUM_ARCHIVE_RETRIES)
                                {
index 8cbed1d1bc3b17fb7f4b003ceaea3c6a5d675907..586dd710ef0ce427e581db83d58b04f67e5cbb00 100644 (file)
@@ -793,7 +793,7 @@ pgstat_report_stat(bool disconnect)
        pgstat_send_funcstats();
 
        /* Send WAL statistics */
-       pgstat_send_wal(true);
+       pgstat_report_wal(true);
 
        /* Finally send SLRU statistics */
        pgstat_send_slru();
index e2c7eb78d690d0a9449c22ee2ded91c3db985f3f..77aebb244cb238f425ba2a02980b41babf084508 100644 (file)
@@ -258,7 +258,7 @@ WalWriterMain(void)
                        left_till_hibernate--;
 
                /* report pending statistics to the cumulative stats system */
-               pgstat_send_wal(false);
+               pgstat_report_wal(false);
 
                /*
                 * Sleep until we are signaled or WalWriterDelay has elapsed.  If we
@@ -297,11 +297,11 @@ HandleWalWriterInterrupts(void)
                /*
                 * Force reporting remaining WAL statistics at process exit.
                 *
-                * Since pgstat_send_wal is invoked with 'force' is false in main loop
+                * Since pgstat_report_wal is invoked with 'force' is false in main loop
                 * to avoid overloading the cumulative stats system, there may exist
                 * unreported stats counters for the WAL writer.
                 */
-               pgstat_send_wal(true);
+               pgstat_report_wal(true);
 
                proc_exit(0);
        }
index c829b91b60c58a65e2500aedf1e702575407bbd2..09bc12070da2acbba14aad72f286ddefc4572090 100644 (file)
@@ -25,7 +25,7 @@
  * Report archiver statistics
  */
 void
-pgstat_send_archiver(const char *xlog, bool failed)
+pgstat_report_archiver(const char *xlog, bool failed)
 {
        PgStat_MsgArchiver msg;
 
index 7e7eae80372bd101aca2768c02ea334ce5fcd0e8..dfea88eca101111b271cfa2fff75682e12cc1224 100644 (file)
@@ -32,7 +32,7 @@ PgStat_MsgBgWriter PendingBgWriterStats;
  * Report bgwriter statistics
  */
 void
-pgstat_send_bgwriter(void)
+pgstat_report_bgwriter(void)
 {
        /* We assume this initializes to zeroes */
        static const PgStat_MsgBgWriter all_zeroes;
index dbb9d861a4b07239a088ae4a911d5c217ffcfce7..3f4e2054f558251ca43947d034855bc2b78a9464 100644 (file)
@@ -32,7 +32,7 @@ PgStat_MsgCheckpointer PendingCheckpointerStats;
  * Report checkpointer statistics
  */
 void
-pgstat_send_checkpointer(void)
+pgstat_report_checkpointer(void)
 {
        /* We assume this initializes to zeroes */
        static const PgStat_MsgCheckpointer all_zeroes;
index ad99988763006f70f12764ad0841f60a12c264c2..8680809deef12ede7d37eb9344dd0cd788e82bd5 100644 (file)
@@ -31,8 +31,8 @@ PgStat_MsgWal WalStats;
 
 /*
  * WAL usage counters saved from pgWALUsage at the previous call to
- * pgstat_send_wal(). This is used to calculate how much WAL usage
- * happens between pgstat_send_wal() calls, by subtracting
+ * pgstat_report_wal(). This is used to calculate how much WAL usage
+ * happens between pgstat_report_wal() calls, by subtracting
  * the previous counters from the current ones.
  */
 static WalUsage prevWalUsage;
@@ -45,7 +45,7 @@ static WalUsage prevWalUsage;
  * passed since last one was sent to reach PGSTAT_STAT_INTERVAL.
  */
 void
-pgstat_send_wal(bool force)
+pgstat_report_wal(bool force)
 {
        static TimestampTz sendTime = 0;
 
@@ -133,7 +133,7 @@ void
 pgstat_wal_initialize(void)
 {
        /*
-        * Initialize prevWalUsage with pgWalUsage so that pgstat_send_wal() can
+        * Initialize prevWalUsage with pgWalUsage so that pgstat_report_wal() can
         * calculate how much pgWalUsage counters are increased by subtracting
         * prevWalUsage from pgWalUsage.
         */
index 77b692751824cce555c5b370ff642007932be8be..aaab2f973b3ef712224cc75eadbd78a88c6943f5 100644 (file)
@@ -997,21 +997,21 @@ extern PgStat_WalStats *pgstat_fetch_stat_wal(void);
  * Functions in pgstat_archiver.c
  */
 
-extern void pgstat_send_archiver(const char *xlog, bool failed);
+extern void pgstat_report_archiver(const char *xlog, bool failed);
 
 
 /*
  * Functions in pgstat_bgwriter.c
  */
 
-extern void pgstat_send_bgwriter(void);
+extern void pgstat_report_bgwriter(void);
 
 
 /*
  * Functions in pgstat_checkpointer.c
  */
 
-extern void pgstat_send_checkpointer(void);
+extern void pgstat_report_checkpointer(void);
 
 
 /*
@@ -1165,7 +1165,7 @@ extern void PostPrepare_PgStat(void);
  * Functions in pgstat_wal.c
  */
 
-extern void pgstat_send_wal(bool force);
+extern void pgstat_report_wal(bool force);
 
 
 /*