pgstat: stats collector references in comments.
authorAndres Freund <[email protected]>
Wed, 6 Apr 2022 20:56:06 +0000 (13:56 -0700)
committerAndres Freund <[email protected]>
Wed, 6 Apr 2022 20:56:06 +0000 (13:56 -0700)
Soon the stats collector will be no more, with statistics instead getting
stored in shared memory. There are a lot of references to the stats collector
in comments. This commit replaces most of these references with "cumulative
statistics system", with the remaining ones getting replaced as part of
subsequent commits.

This is done separately from the - quite large - shared memory statistics
patch to make review easier.

Author: Andres Freund <[email protected]>
Reviewed-By: Justin Pryzby <[email protected]>
Reviewed-By: Thomas Munro <[email protected]>
Reviewed-By: Kyotaro Horiguchi <[email protected]>
Discussion: https://postgr.es/m/20220303021600[email protected]
Discussion: https://postgr.es/m/20220308205351[email protected]

31 files changed:
contrib/test_decoding/t/001_repl_stats.pl
src/backend/access/heap/heapam_handler.c
src/backend/access/heap/vacuumlazy.c
src/backend/commands/analyze.c
src/backend/commands/dbcommands.c
src/backend/commands/matview.c
src/backend/commands/subscriptioncmds.c
src/backend/commands/vacuum.c
src/backend/postmaster/autovacuum.c
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/replication/basebackup.c
src/backend/tcop/postgres.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_database.c
src/backend/utils/activity/pgstat_relation.c
src/backend/utils/activity/pgstat_replslot.c
src/backend/utils/activity/pgstat_slru.c
src/backend/utils/activity/pgstat_subscription.c
src/backend/utils/adt/pgstatfuncs.c
src/backend/utils/error/elog.c
src/include/pgstat.h
src/include/utils/backend_status.h
src/include/utils/pgstat_internal.h
src/test/regress/expected/stats.out
src/test/regress/sql/stats.sql

index fd82244a15c25b9db8ea58cc7c48f1d142bb2279..daf03ff14797f08d584b68a37351a2562e0d792a 100644 (file)
@@ -88,8 +88,7 @@ regression_slot3|t|t),
 # Test to remove one of the replication slots and adjust
 # max_replication_slots accordingly to the number of slots. This leads
 # to a mismatch between the number of slots present in the stats file and the
-# number of stats present in the shared memory, simulating the scenario for
-# drop slot message lost by the statistics collector process. We verify
+# number of stats present in shared memory. We verify
 # replication statistics data is fine after restart.
 
 $node->stop;
index 3a9532cb4f7addee6212c1cf7d18ef36ad696e47..666b6205a7bd9646e8ebb2257b0a332d347497ed 100644 (file)
@@ -1089,8 +1089,8 @@ heapam_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin,
                                 * our own.  In this case we should count and sample the row,
                                 * to accommodate users who load a table and analyze it in one
                                 * transaction.  (pgstat_report_analyze has to adjust the
-                                * numbers we send to the stats collector to make this come
-                                * out right.)
+                                * numbers we report to the cumulative stats system to make
+                                * this come out right.)
                                 */
                                if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(targtuple->t_data)))
                                {
index 9cdc8008c1e842698e44954e7d389ebe0b905592..092b739dda94398911d5e7bc43f989d89a0eb67e 100644 (file)
@@ -609,9 +609,9 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
                                                &frozenxid_updated, &minmulti_updated, false);
 
        /*
-        * Report results to the stats collector, too.
+        * Report results to the cumulative stats system, too.
         *
-        * Deliberately avoid telling the stats collector about LP_DEAD items that
+        * Deliberately avoid telling the stats system about LP_DEAD items that
         * remain in the table due to VACUUM bypassing index and heap vacuuming.
         * ANALYZE will consider the remaining LP_DEAD items to be dead "tuples".
         * It seems like a good idea to err on the side of not vacuuming again too
@@ -2228,10 +2228,10 @@ lazy_vacuum(LVRelState *vacrel)
                 * dead_items space is not CPU cache resident.
                 *
                 * We don't take any special steps to remember the LP_DEAD items (such
-                * as counting them in our final report to the stats collector) when
+                * as counting them in our final update to the stats system) when
                 * the optimization is applied.  Though the accounting used in
                 * analyze.c's acquire_sample_rows() will recognize the same LP_DEAD
-                * items as dead rows in its own stats collector report, that's okay.
+                * items as dead rows in its own stats report, that's okay.
                 * The discrepancy should be negligible.  If this optimization is ever
                 * expanded to cover more cases then this may need to be reconsidered.
                 */
index 736479295ade9e31d3c9c5626ad26218289790f4..305226692a470d4f705a8d548f90435249459a1d 100644 (file)
@@ -680,7 +680,7 @@ do_analyze_rel(Relation onerel, VacuumParams *params,
        }
 
        /*
-        * Now report ANALYZE to the stats collector.  For regular tables, we do
+        * Now report ANALYZE to the cumulative stats system.  For regular tables, we do
         * it only if not doing inherited stats.  For partitioned tables, we only
         * do it for inherited stats. (We're never called for not-inherited stats
         * on partitioned tables anyway.)
index df16533901e8239cb64638234080da34d47754a7..ce776c53cadb1a109993e589991cb4e310341060 100644 (file)
@@ -1665,7 +1665,7 @@ dropdb(const char *dbname, bool missing_ok, bool force)
        DropDatabaseBuffers(db_id);
 
        /*
-        * Tell the stats collector to forget it immediately, too.
+        * Tell the cumulative stats system to forget it immediately, too.
         */
        pgstat_drop_database(db_id);
 
index 05e7b60059dbba23bc57f8b3f71abdd39a40b783..9ab248d25e0889cc5712a76d3a548365b2fe0b8e 100644 (file)
@@ -338,10 +338,10 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
                refresh_by_heap_swap(matviewOid, OIDNewHeap, relpersistence);
 
                /*
-                * Inform stats collector about our activity: basically, we truncated
-                * the matview and inserted some new data.  (The concurrent code path
-                * above doesn't need to worry about this because the inserts and
-                * deletes it issues get counted by lower-level code.)
+                * Inform cumulative stats system about our activity: basically, we
+                * truncated the matview and inserted some new data.  (The concurrent
+                * code path above doesn't need to worry about this because the inserts
+                * and deletes it issues get counted by lower-level code.)
                 */
                pgstat_count_truncate(matviewRel);
                if (!stmt->skipData)
index 85dacbe93d69ae1e94bc61118f6d08436e6d138f..51505373ea4fd54b65c83871b7dc499dd7004860 100644 (file)
@@ -1409,7 +1409,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
         * slot stays dropped even if the transaction rolls back.  So we cannot
         * run DROP SUBSCRIPTION inside a transaction block if dropping the
         * replication slot.  Also, in this case, we report a message for dropping
-        * the subscription to the stats collector.
+        * the subscription to the cumulative stats system.
         *
         * XXX The command name should really be something like "DROP SUBSCRIPTION
         * of a subscription that is associated with a replication slot", but we
@@ -1583,7 +1583,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
        PG_END_TRY();
 
        /*
-        * Send a message for dropping this subscription to the stats collector.
+        * Tell the cumulative stats system that the subscription is getting dropped.
         * We can safely report dropping the subscription statistics here if the
         * subscription is associated with a replication slot since we cannot run
         * DROP SUBSCRIPTION inside a transaction block.  Subscription statistics
index fb33953e350472969c5da4f0378c3c8a8d34b566..04dbbe5530af595e69f8f72d4b326f520b92b77e 100644 (file)
@@ -352,8 +352,8 @@ vacuum(List *relations, VacuumParams *params,
                                 errmsg("PROCESS_TOAST required with VACUUM FULL")));
 
        /*
-        * Send info about dead objects to the statistics collector, unless we are
-        * in autovacuum --- autovacuum.c does this for itself.
+        * Send info about dead objects to the cumulative stats system, unless
+        * we are in autovacuum --- autovacuum.c does this for itself.
         */
        if ((params->options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
                pgstat_vacuum_stat();
index 681ef91b81e28219807692b0137b561f99ce28e3..c6d30fa5271c29f17b8cab0e984b8f93115fd143 100644 (file)
@@ -1689,7 +1689,7 @@ AutoVacWorkerMain(int argc, char *argv[])
                char            dbname[NAMEDATALEN];
 
                /*
-                * Report autovac startup to the stats collector.  We deliberately do
+                * Report autovac startup to the cumulative stats system.  We deliberately do
                 * this before InitPostgres, so that the last_autovac_time will get
                 * updated even if the connection attempt fails.  This is to prevent
                 * autovac from getting "stuck" repeatedly selecting an unopenable
@@ -1996,9 +1996,9 @@ do_autovacuum(void)
        StartTransactionCommand();
 
        /*
-        * Clean up any dead statistics collector entries for this DB. We always
-        * want to do this exactly once per DB-processing cycle, even if we find
-        * nothing worth vacuuming in the database.
+        * Clean up any dead statistics entries for this DB. We always want to do
+        * this exactly once per DB-processing cycle, even if we find nothing
+        * worth vacuuming in the database.
         */
        pgstat_vacuum_stat();
 
@@ -3041,7 +3041,7 @@ recheck_relation_needs_vacanalyze(Oid relid,
  *
  * For analyze, the analysis done is that the number of tuples inserted,
  * deleted and updated since the last analyze exceeds a threshold calculated
- * in the same fashion as above.  Note that the collector actually stores
+ * in the same fashion as above.  Note that the cumulative stats system stores
  * the number of tuples (both live and dead) that there were as of the last
  * analyze.  This is asymmetric to the VACUUM case.
  *
@@ -3051,8 +3051,8 @@ recheck_relation_needs_vacanalyze(Oid relid,
  *
  * A table whose autovacuum_enabled option is false is
  * automatically skipped (unless we have to vacuum it due to freeze_max_age).
- * Thus autovacuum can be disabled for specific tables. Also, when the stats
- * collector does not have data about a table, it will be skipped.
+ * Thus autovacuum can be disabled for specific tables. Also, when the cumulative
+ * stats system does not have data about a table, it will be skipped.
  *
  * A table whose vac_base_thresh value is < 0 takes the base value from the
  * autovacuum_vacuum_threshold GUC variable.  Similarly, a vac_scale_factor
index d1f5d12eff8aeca56f3925b8f19513dcf8fd7e77..447596b2a8b0126982d45e45d5769343c545011c 100644 (file)
@@ -240,9 +240,7 @@ BackgroundWriterMain(void)
                 */
                can_hibernate = BgBufferSync(&wb_context);
 
-               /*
-                * Send off activity statistics to the stats collector
-                */
+               /* Report pending statistics to the cumulative stats system */
                pgstat_send_bgwriter();
 
                if (FirstCallSinceLastCheckpoint())
index a59c3cf02015267df7f6bdcac18156dcdf943db2..80914aa891c4c92bd6f3bb8b3baac4ae60b7432a 100644 (file)
@@ -492,12 +492,8 @@ CheckpointerMain(void)
                /* Check for archive_timeout and switch xlog files if necessary. */
                CheckArchiveTimeout();
 
-               /*
-                * Send off activity statistics to the stats collector.
-                */
+               /* Report pending statistics to the cumulative stats system */
                pgstat_send_checkpointer();
-
-               /* Send WAL statistics to the stats collector. */
                pgstat_send_wal(true);
 
                /*
@@ -570,8 +566,8 @@ HandleCheckpointerInterrupts(void)
                 * Close down the database.
                 *
                 * Since ShutdownXLOG() creates restartpoint or checkpoint, and
-                * updates the statistics, increment the checkpoint request and send
-                * the statistics to the stats collector.
+                * updates the statistics, increment the checkpoint request and flush
+                * out pending statistic.
                 */
                PendingCheckpointerStats.m_requested_checkpoints++;
                ShutdownXLOG(0, 0);
@@ -718,9 +714,7 @@ CheckpointWriteDelay(int flags, double progress)
 
                CheckArchiveTimeout();
 
-               /*
-                * Report interim activity statistics.
-                */
+               /* Report interim statistics to the cumulative stats system */
                pgstat_send_checkpointer();
 
                /*
index d916ed39a8c45f93ca519a1c0dc55d4d460286f2..adfa404f4642a3f789009bf6ef6be2c31ff6cbae 100644 (file)
@@ -477,8 +477,8 @@ pgarch_ArchiverCopyLoop(void)
                                pgarch_archiveDone(xlog);
 
                                /*
-                                * Tell the collector about the WAL file that we successfully
-                                * archived
+                                * Tell the cumulative stats system about the WAL file that we
+                                * successfully archived
                                 */
                                pgstat_send_archiver(xlog, false);
 
@@ -487,8 +487,8 @@ pgarch_ArchiverCopyLoop(void)
                        else
                        {
                                /*
-                                * Tell the collector about the WAL file that we failed to
-                                * archive
+                                * Tell the cumulative stats system about the WAL file that we
+                                * failed to archive
                                 */
                                pgstat_send_archiver(xlog, true);
 
index 6757df397cf290c8a0051d48b81bd7308cf75392..8cbed1d1bc3b17fb7f4b003ceaea3c6a5d675907 100644 (file)
@@ -693,9 +693,9 @@ allow_immediate_pgstat_restart(void)
 /*
  * Shut down a single backend's statistics reporting at process exit.
  *
- * Flush any remaining statistics counts out to the collector.
- * Without this, operations triggered during backend exit (such as
- * temp table deletions) won't be counted.
+ * Flush out any remaining statistics counts.  Without this, operations
+ * triggered during backend exit (such as temp table deletions) won't be
+ * counted.
  */
 static void
 pgstat_shutdown_hook(int code, Datum arg)
@@ -703,10 +703,10 @@ pgstat_shutdown_hook(int code, Datum arg)
        Assert(!pgstat_is_shutdown);
 
        /*
-        * If we got as far as discovering our own database ID, we can report what
-        * we did to the collector.  Otherwise, we'd be sending an invalid
-        * database ID, so forget it.  (This means that accesses to pg_database
-        * during failed backend starts might never get counted.)
+        * If we got as far as discovering our own database ID, we can flush out
+        * what we did so far.  Otherwise, we'd be reporting an invalid database
+        * ID, so forget it.  (This means that accesses to pg_database during
+        * failed backend starts might never get counted.)
         */
        if (OidIsValid(MyDatabaseId))
                pgstat_report_stat(true);
@@ -1065,7 +1065,7 @@ pgstat_collect_oids(Oid catalogid, AttrNumber anum_oid)
 }
 
 /*
- * Tell the statistics collector to reset counters for our database.
+ * Reset counters for our database.
  *
  * Permission checking for this function is managed through the normal
  * GRANT system.
@@ -1084,7 +1084,7 @@ pgstat_reset_counters(void)
 }
 
 /*
- * Tell the statistics collector to reset a single counter.
+ * Reset a single counter.
  *
  * Permission checking for this function is managed through the normal
  * GRANT system.
@@ -1106,7 +1106,7 @@ pgstat_reset_single_counter(Oid objoid, PgStat_Single_Reset_Type type)
 }
 
 /*
- * Tell the statistics collector to reset cluster-wide shared counters.
+ * Reset cluster-wide shared counters.
  *
  * Permission checking for this function is managed through the normal
  * GRANT system.
@@ -1198,8 +1198,8 @@ pgstat_clear_snapshot(void)
 /*
  * Support function for the SQL-callable pgstat* functions. Returns
  * the collected statistics for one database or NULL. NULL doesn't mean
- * that the database doesn't exist, it is just not yet known by the
- * collector, so the caller is better off to report ZERO instead.
+ * that the database doesn't exist, just that there are no statistics, so the
+ * caller is better off to report ZERO instead.
  */
 PgStat_StatDBEntry *
 pgstat_fetch_stat_dbentry(Oid dbid)
@@ -1233,8 +1233,8 @@ pgstat_fetch_global(void)
 /*
  * Support function for the SQL-callable pgstat* functions. Returns
  * the collected statistics for one table or NULL. NULL doesn't mean
- * that the table doesn't exist, it is just not yet known by the
- * collector, so the caller is better off to report ZERO instead.
+ * that the table doesn't exist, just that there are no statistics, so the
+ * caller is better off to report ZERO instead.
  */
 PgStat_StatTabEntry *
 pgstat_fetch_stat_tabentry(Oid relid)
index 102fa2a089f69d8312951e9fcc0da79af8414425..e2c7eb78d690d0a9449c22ee2ded91c3db985f3f 100644 (file)
@@ -257,7 +257,7 @@ WalWriterMain(void)
                else if (left_till_hibernate > 0)
                        left_till_hibernate--;
 
-               /* Send WAL statistics to the stats collector */
+               /* report pending statistics to the cumulative stats system */
                pgstat_send_wal(false);
 
                /*
@@ -295,12 +295,11 @@ HandleWalWriterInterrupts(void)
        if (ShutdownRequestPending)
        {
                /*
-                * Force to send remaining WAL statistics to the stats collector at
-                * process exit.
+                * Force reporting remaining WAL statistics at process exit.
                 *
                 * Since pgstat_send_wal is invoked with 'force' is false in main loop
-                * to avoid overloading to the stats collector, there may exist unsent
-                * stats counters for the WAL writer.
+                * to avoid overloading the cumulative stats system, there may exist
+                * unreported stats counters for the WAL writer.
                 */
                pgstat_send_wal(true);
 
index 815681ada7dd0c135af584ad5da2dd13c9a12465..f01fff3a9044ec1fbf9b04850539a9f1e7c22bd0 100644 (file)
@@ -1505,8 +1505,8 @@ is_checksummed_file(const char *fullpath, const char *filename)
  *
  * If 'missing_ok' is true, will not throw an error if the file is not found.
  *
- * If dboid is anything other than InvalidOid then any checksum failures detected
- * will get reported to the stats collector.
+ * If dboid is anything other than InvalidOid then any checksum failures
+ * detected will get reported to the cumulative stats system.
  *
  * Returns true if the file was successfully sent, false if 'missing_ok',
  * and the file did not exist.
index ba2fcfeb4af18525892a655ec17e1b8077156983..260b650f15f74aacffdf262906e5aeed696b4b3a 100644 (file)
@@ -2937,7 +2937,7 @@ die(SIGNAL_ARGS)
                ProcDiePending = true;
        }
 
-       /* for the statistics collector */
+       /* for the cumulative stats system */
        pgStatSessionEndCause = DISCONNECT_KILLED;
 
        /* If we're still here, waken anything waiting on the process latch */
@@ -4368,8 +4368,8 @@ PostgresMain(const char *dbname, const char *username)
                 *
                 * Note: this includes fflush()'ing the last of the prior output.
                 *
-                * This is also a good time to send collected statistics to the
-                * collector, and to update the PS stats display.  We avoid doing
+                * This is also a good time to flush out collected statistics to the
+                * cumulative stats system, and to update the PS stats display.  We avoid doing
                 * those every time through the message loop because it'd slow down
                 * processing of batched messages, and because we don't want to report
                 * uncommitted updates (that confuses autovacuum).  The notification
@@ -4710,7 +4710,7 @@ PostgresMain(const char *dbname, const char *username)
                                 */
                        case EOF:
 
-                               /* for the statistics collector */
+                               /* for the cumulative statistics system */
                                pgStatSessionEndCause = DISCONNECT_CLIENT_EOF;
 
                                /* FALLTHROUGH */
index 4a37b8f6e764d1492e26ec94151a67bae2677b4b..c829b91b60c58a65e2500aedf1e702575407bbd2 100644 (file)
@@ -22,8 +22,7 @@
 
 
 /*
- * Tell the collector about the WAL file that we successfully
- * archived or failed to archive.
+ * Report archiver statistics
  */
 void
 pgstat_send_archiver(const char *xlog, bool failed)
index 0d9421666d8320474bd29bbe287781875976f7a9..7e7eae80372bd101aca2768c02ea334ce5fcd0e8 100644 (file)
@@ -29,7 +29,7 @@ PgStat_MsgBgWriter PendingBgWriterStats;
 
 
 /*
- * Send bgwriter statistics to the collector
+ * Report bgwriter statistics
  */
 void
 pgstat_send_bgwriter(void)
index f8358eb4e0cf80cb44794ac440fca7c075a1b67c..dbb9d861a4b07239a088ae4a911d5c217ffcfce7 100644 (file)
@@ -29,7 +29,7 @@ PgStat_MsgCheckpointer PendingCheckpointerStats;
 
 
 /*
- * Send checkpointer statistics to the collector
+ * Report checkpointer statistics
  */
 void
 pgstat_send_checkpointer(void)
index 6c38fe86a42833046c8b19c18128e74d15d3ac8f..6d27657bdb20905be4d5aec90a4444eb39cc81cf 100644 (file)
@@ -75,7 +75,7 @@ pgstat_report_autovac(Oid dboid)
 }
 
 /*
- * Tell the collector about a Hot Standby recovery conflict.
+ * Report a Hot Standby recovery conflict.
  */
 void
 pgstat_report_recovery_conflict(int reason)
@@ -92,7 +92,7 @@ pgstat_report_recovery_conflict(int reason)
 }
 
 /*
- * Tell the collector about a deadlock detected.
+ * Report a detected deadlock.
  */
 void
 pgstat_report_deadlock(void)
@@ -108,7 +108,7 @@ pgstat_report_deadlock(void)
 }
 
 /*
- * Tell the collector about one or more checksum failures.
+ * Report one or more checksum failures.
  */
 void
 pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount)
@@ -127,7 +127,7 @@ pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount)
 }
 
 /*
- * Tell the collector about a checksum failure.
+ * Report one checksum failure in the current database.
  */
 void
 pgstat_report_checksum_failure(void)
@@ -136,7 +136,7 @@ pgstat_report_checksum_failure(void)
 }
 
 /*
- * Tell the collector about a temporary file.
+ * Report creation of temporary file.
  */
 void
 pgstat_report_tempfile(size_t filesize)
@@ -153,7 +153,7 @@ pgstat_report_tempfile(size_t filesize)
 }
 
 /*
- * Tell the collector about a new connection.
+ * Notify stats system of a new connection.
  */
 void
 pgstat_report_connect(Oid dboid)
@@ -171,7 +171,7 @@ pgstat_report_connect(Oid dboid)
 }
 
 /*
- * Tell the collector about a disconnect.
+ * Notify the stats system of a disconnect.
  */
 void
 pgstat_report_disconnect(Oid dboid)
index 957f5b858a5b672f5d08f706bb61a9d56acbf495..a78b8d2450f77a234c96ae491761cd5c80fbca82 100644 (file)
@@ -168,7 +168,7 @@ pgstat_drop_relation(Oid relid)
 #endif                                                 /* NOT_USED */
 
 /*
- * Tell the collector about the table we just vacuumed.
+ * Report that the table was just vacuumed.
  */
 void
 pgstat_report_vacuum(Oid tableoid, bool shared,
@@ -190,7 +190,7 @@ pgstat_report_vacuum(Oid tableoid, bool shared,
 }
 
 /*
- * Tell the collector about the table we just analyzed.
+ * Report that the table was just analyzed.
  *
  * Caller must provide new live- and dead-tuples estimates, as well as a
  * flag indicating whether to reset the changes_since_analyze counter.
@@ -210,10 +210,10 @@ pgstat_report_analyze(Relation rel,
         * already inserted and/or deleted rows in the target table. ANALYZE will
         * have counted such rows as live or dead respectively. Because we will
         * report our counts of such rows at transaction end, we should subtract
-        * off these counts from what we send to the collector now, else they'll
-        * be double-counted after commit.  (This approach also ensures that the
-        * collector ends up with the right numbers if we abort instead of
-        * committing.)
+        * off these counts from the update we're making now, else they'll be
+        * double-counted after commit.  (This approach also ensures that the
+        * shared stats entry ends up with the right numbers if we abort instead
+        * of committing.)
         *
         * Waste no time on partitioned tables, though.
         */
@@ -537,8 +537,8 @@ AtPrepare_PgStat_Relations(PgStat_SubXactStatus *xact_state)
 /*
  * All we need do here is unlink the transaction stats state from the
  * nontransactional state.  The nontransactional action counts will be
- * reported to the stats collector immediately, while the effects on
- * live and dead tuple counts are preserved in the 2PC state file.
+ * reported to the stats system immediately, while the effects on live and
+ * dead tuple counts are preserved in the 2PC state file.
  *
  * Note: AtEOXact_PgStat_Relations is not called during PREPARE.
  */
index a9405cd135eee66e62e3560278f2e727caea24f5..35078ad73c8eb3a68788332b616f01cc8861a411 100644 (file)
@@ -23,8 +23,8 @@
 
 
 /*
- * Tell the statistics collector to reset a single replication slot
- * counter, or all replication slots counters (when name is null).
+ * Reset counters for a single replication slot, or all replication slots
+ * (when name is null).
  *
  * Permission checking for this function is managed through the normal
  * GRANT system.
@@ -51,7 +51,7 @@ pgstat_reset_replslot_counter(const char *name)
 }
 
 /*
- * Tell the collector about replication slot statistics.
+ * Report replication slot statistics.
  */
 void
 pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat)
@@ -77,7 +77,7 @@ pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat)
 }
 
 /*
- * Tell the collector about creating the replication slot.
+ * Report replication slot creation.
  */
 void
 pgstat_report_replslot_create(const char *slotname)
@@ -92,7 +92,7 @@ pgstat_report_replslot_create(const char *slotname)
 }
 
 /*
- * Tell the collector about dropping the replication slot.
+ * Report replication slot drop.
  */
 void
 pgstat_report_replslot_drop(const char *slotname)
index 3e284900b15c602d6a5fc06c29ac58e40ee22086..6dae3a5dc66571b42e0b2c9992ea5130bdd8b847 100644 (file)
@@ -33,8 +33,7 @@ static PgStat_MsgSLRU SLRUStats[SLRU_NUM_ELEMENTS];
 
 
 /*
- * Tell the statistics collector to reset a single SLRU counter, or all
- * SLRU counters (when name is null).
+ * Reset counters for a single SLRU, or all SLRUs (when name is null).
  *
  * Permission checking for this function is managed through the normal
  * GRANT system.
index 70874e13f5e20b1da959235b98632c3ee97c257a..2ee23d5ae2c6aa66176b48029c2197268eeab969 100644 (file)
@@ -21,8 +21,8 @@
 
 
 /*
- * Tell the statistics collector to reset a single subscription
- * counter, or all subscription counters (when subid is InvalidOid).
+ * Reset counters for a single subscription, or all subscriptions (when subid
+ * is InvalidOid).
  *
  * Permission checking for this function is managed through the normal
  * GRANT system.
@@ -42,7 +42,7 @@ pgstat_reset_subscription_counter(Oid subid)
 }
 
 /*
- * Tell the collector about the subscription error.
+ * Report a subscription error.
  */
 void
 pgstat_report_subscription_error(Oid subid, bool is_apply_error)
@@ -56,7 +56,7 @@ pgstat_report_subscription_error(Oid subid, bool is_apply_error)
 }
 
 /*
- * Tell the collector about dropping the subscription.
+ * Report dropping the subscription.
  */
 void
 pgstat_report_subscription_drop(Oid subid)
index ce84525d40215ef2f49b50c7f86f21d2f8b984a1..fd4276fbc6719351df11d9212f340021099c0de4 100644 (file)
@@ -1,7 +1,7 @@
 /*-------------------------------------------------------------------------
  *
  * pgstatfuncs.c
- *       Functions for accessing the statistics collector data
+ *       Functions for accessing various forms of statistics data
  *
  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
@@ -1820,7 +1820,7 @@ pg_stat_get_slru(PG_FUNCTION_ARGS)
 
        SetSingleFuncCall(fcinfo, 0);
 
-       /* request SLRU stats from the stat collector */
+       /* request SLRU stats from the cumulative stats system */
        stats = pgstat_fetch_slru();
 
        for (i = 0;; i++)
index 7402696986be3e51068ae790fa3399561447e68d..bd4b2c19b1c37ed13d1078f3043f3d8a53eff4c7 100644 (file)
@@ -647,7 +647,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
                fflush(stderr);
 
                /*
-                * Let the statistics collector know. Only mark the session as
+                * Let the cumulative stats system know. Only mark the session as
                 * terminated by fatal error if there is no other known cause.
                 */
                if (pgStatSessionEndCause == DISCONNECT_NORMAL)
index 95bf06f8291bac410d5e9225cda76593f1886160..77b692751824cce555c5b370ff642007932be8be 100644 (file)
@@ -1,7 +1,7 @@
 /* ----------
  *     pgstat.h
  *
- *     Definitions for the PostgreSQL statistics collector daemon.
+ *     Definitions for the PostgreSQL cumulative statistics system.
  *
  *     Copyright (c) 2001-2022, PostgreSQL Global Development Group
  *
@@ -86,7 +86,7 @@ typedef enum PgStat_Single_Reset_Type
  * it against zeroes to detect whether there are any counts to transmit.
  *
  * Note that the time counters are in instr_time format here.  We convert to
- * microseconds in PgStat_Counter format when transmitting to the collector.
+ * microseconds in PgStat_Counter format when flushing out pending statistics.
  * ----------
  */
 typedef struct PgStat_FunctionCounts
index 8217d0cb6b7902e5984d94362e0d2da575f93b30..7403bca25ed18cad523cc13176f8bc93ea34c2a2 100644 (file)
@@ -85,8 +85,8 @@ typedef struct PgBackendGSSStatus
  *
  * Each live backend maintains a PgBackendStatus struct in shared memory
  * showing its current activity.  (The structs are allocated according to
- * BackendId, but that is not critical.)  Note that the collector process
- * has no involvement in, or even access to, these structs.
+ * BackendId, but that is not critical.)  Note that this is unrelated to the
+ * cumulative stats system (i.e. pgstat.c et al).
  *
  * Each auxiliary process also maintains a PgBackendStatus struct in shared
  * memory.
index 6a828e3aa002d7418dfd94ca228b1b4ef9d0c69f..1923f56a3adfe285f6eef5ddf6c33212de4eb73b 100644 (file)
@@ -1,7 +1,7 @@
 /* ----------
  * pgstat_internal.h
  *
- * Definitions for the PostgreSQL activity statistics facility that should
+ * Definitions for the PostgreSQL cumulative statistics system that should
  * only be needed by files implementing statistics support (rather than ones
  * reporting / querying stats).
  *
index 06a1d2f229b7cc652bd8f92f42b7b0703dc336f3..494fb2623752d8a7e9e0febe55749abdce7e092e 100644 (file)
@@ -1,5 +1,5 @@
 --
--- Test Statistics Collector
+-- Test cumulative stats system
 --
 -- Must be run after tenk2 has been created (by create_table),
 -- populated (by create_misc) and indexed (by create_index).
index ae1ec173e32d4d4347fe8633ae29cff0af67f53b..d0ba1f6d7baaafe95c2574db2bb2057556822d16 100644 (file)
@@ -1,5 +1,5 @@
 --
--- Test Statistics Collector
+-- Test cumulative stats system
 --
 -- Must be run after tenk2 has been created (by create_table),
 -- populated (by create_misc) and indexed (by create_index).