pgstat: stats collector references in comments.

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 <andres@anarazel.de>
Reviewed-By: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de
Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de
This commit is contained in:
Andres Freund 2022-04-06 13:56:06 -07:00
parent ab62a642d5
commit bdbd3d9064
31 changed files with 95 additions and 107 deletions

View File

@ -88,8 +88,7 @@ regression_slot3|t|t),
# Test to remove one of the replication slots and adjust # Test to remove one of the replication slots and adjust
# max_replication_slots accordingly to the number of slots. This leads # 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 # 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 # number of stats present in shared memory. We verify
# drop slot message lost by the statistics collector process. We verify
# replication statistics data is fine after restart. # replication statistics data is fine after restart.
$node->stop; $node->stop;

View 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, * our own. In this case we should count and sample the row,
* to accommodate users who load a table and analyze it in one * to accommodate users who load a table and analyze it in one
* transaction. (pgstat_report_analyze has to adjust the * transaction. (pgstat_report_analyze has to adjust the
* numbers we send to the stats collector to make this come * numbers we report to the cumulative stats system to make
* out right.) * this come out right.)
*/ */
if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(targtuple->t_data))) if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(targtuple->t_data)))
{ {

View File

@ -609,9 +609,9 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
&frozenxid_updated, &minmulti_updated, false); &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. * remain in the table due to VACUUM bypassing index and heap vacuuming.
* ANALYZE will consider the remaining LP_DEAD items to be dead "tuples". * 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 * 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. * dead_items space is not CPU cache resident.
* *
* We don't take any special steps to remember the LP_DEAD items (such * 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 * the optimization is applied. Though the accounting used in
* analyze.c's acquire_sample_rows() will recognize the same LP_DEAD * 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 * The discrepancy should be negligible. If this optimization is ever
* expanded to cover more cases then this may need to be reconsidered. * expanded to cover more cases then this may need to be reconsidered.
*/ */

View 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 * 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 * do it for inherited stats. (We're never called for not-inherited stats
* on partitioned tables anyway.) * on partitioned tables anyway.)

View File

@ -1665,7 +1665,7 @@ dropdb(const char *dbname, bool missing_ok, bool force)
DropDatabaseBuffers(db_id); 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); pgstat_drop_database(db_id);

View File

@ -338,10 +338,10 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString,
refresh_by_heap_swap(matviewOid, OIDNewHeap, relpersistence); refresh_by_heap_swap(matviewOid, OIDNewHeap, relpersistence);
/* /*
* Inform stats collector about our activity: basically, we truncated * Inform cumulative stats system about our activity: basically, we
* the matview and inserted some new data. (The concurrent code path * truncated the matview and inserted some new data. (The concurrent
* above doesn't need to worry about this because the inserts and * code path above doesn't need to worry about this because the inserts
* deletes it issues get counted by lower-level code.) * and deletes it issues get counted by lower-level code.)
*/ */
pgstat_count_truncate(matviewRel); pgstat_count_truncate(matviewRel);
if (!stmt->skipData) if (!stmt->skipData)

View File

@ -1409,7 +1409,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
* slot stays dropped even if the transaction rolls back. So we cannot * slot stays dropped even if the transaction rolls back. So we cannot
* run DROP SUBSCRIPTION inside a transaction block if dropping the * run DROP SUBSCRIPTION inside a transaction block if dropping the
* replication slot. Also, in this case, we report a message for dropping * 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 * XXX The command name should really be something like "DROP SUBSCRIPTION
* of a subscription that is associated with a replication slot", but we * of a subscription that is associated with a replication slot", but we
@ -1583,7 +1583,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
PG_END_TRY(); 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 * We can safely report dropping the subscription statistics here if the
* subscription is associated with a replication slot since we cannot run * subscription is associated with a replication slot since we cannot run
* DROP SUBSCRIPTION inside a transaction block. Subscription statistics * DROP SUBSCRIPTION inside a transaction block. Subscription statistics

View File

@ -352,8 +352,8 @@ vacuum(List *relations, VacuumParams *params,
errmsg("PROCESS_TOAST required with VACUUM FULL"))); errmsg("PROCESS_TOAST required with VACUUM FULL")));
/* /*
* Send info about dead objects to the statistics collector, unless we are * Send info about dead objects to the cumulative stats system, unless
* in autovacuum --- autovacuum.c does this for itself. * we are in autovacuum --- autovacuum.c does this for itself.
*/ */
if ((params->options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess()) if ((params->options & VACOPT_VACUUM) && !IsAutoVacuumWorkerProcess())
pgstat_vacuum_stat(); pgstat_vacuum_stat();

View File

@ -1689,7 +1689,7 @@ AutoVacWorkerMain(int argc, char *argv[])
char dbname[NAMEDATALEN]; 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 * this before InitPostgres, so that the last_autovac_time will get
* updated even if the connection attempt fails. This is to prevent * updated even if the connection attempt fails. This is to prevent
* autovac from getting "stuck" repeatedly selecting an unopenable * autovac from getting "stuck" repeatedly selecting an unopenable
@ -1996,9 +1996,9 @@ do_autovacuum(void)
StartTransactionCommand(); StartTransactionCommand();
/* /*
* Clean up any dead statistics collector entries for this DB. We always * Clean up any dead statistics entries for this DB. We always want to do
* want to do this exactly once per DB-processing cycle, even if we find * this exactly once per DB-processing cycle, even if we find nothing
* nothing worth vacuuming in the database. * worth vacuuming in the database.
*/ */
pgstat_vacuum_stat(); 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, * For analyze, the analysis done is that the number of tuples inserted,
* deleted and updated since the last analyze exceeds a threshold calculated * 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 * the number of tuples (both live and dead) that there were as of the last
* analyze. This is asymmetric to the VACUUM case. * 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 * A table whose autovacuum_enabled option is false is
* automatically skipped (unless we have to vacuum it due to freeze_max_age). * 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 * Thus autovacuum can be disabled for specific tables. Also, when the cumulative
* collector does not have data about a table, it will be skipped. * 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 * 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 * autovacuum_vacuum_threshold GUC variable. Similarly, a vac_scale_factor

View File

@ -240,9 +240,7 @@ BackgroundWriterMain(void)
*/ */
can_hibernate = BgBufferSync(&wb_context); can_hibernate = BgBufferSync(&wb_context);
/* /* Report pending statistics to the cumulative stats system */
* Send off activity statistics to the stats collector
*/
pgstat_send_bgwriter(); pgstat_send_bgwriter();
if (FirstCallSinceLastCheckpoint()) if (FirstCallSinceLastCheckpoint())

View File

@ -492,12 +492,8 @@ CheckpointerMain(void)
/* Check for archive_timeout and switch xlog files if necessary. */ /* Check for archive_timeout and switch xlog files if necessary. */
CheckArchiveTimeout(); CheckArchiveTimeout();
/* /* Report pending statistics to the cumulative stats system */
* Send off activity statistics to the stats collector.
*/
pgstat_send_checkpointer(); pgstat_send_checkpointer();
/* Send WAL statistics to the stats collector. */
pgstat_send_wal(true); pgstat_send_wal(true);
/* /*
@ -570,8 +566,8 @@ HandleCheckpointerInterrupts(void)
* Close down the database. * Close down the database.
* *
* Since ShutdownXLOG() creates restartpoint or checkpoint, and * Since ShutdownXLOG() creates restartpoint or checkpoint, and
* updates the statistics, increment the checkpoint request and send * updates the statistics, increment the checkpoint request and flush
* the statistics to the stats collector. * out pending statistic.
*/ */
PendingCheckpointerStats.m_requested_checkpoints++; PendingCheckpointerStats.m_requested_checkpoints++;
ShutdownXLOG(0, 0); ShutdownXLOG(0, 0);
@ -718,9 +714,7 @@ CheckpointWriteDelay(int flags, double progress)
CheckArchiveTimeout(); CheckArchiveTimeout();
/* /* Report interim statistics to the cumulative stats system */
* Report interim activity statistics.
*/
pgstat_send_checkpointer(); pgstat_send_checkpointer();
/* /*

View File

@ -477,8 +477,8 @@ pgarch_ArchiverCopyLoop(void)
pgarch_archiveDone(xlog); pgarch_archiveDone(xlog);
/* /*
* Tell the collector about the WAL file that we successfully * Tell the cumulative stats system about the WAL file that we
* archived * successfully archived
*/ */
pgstat_send_archiver(xlog, false); pgstat_send_archiver(xlog, false);
@ -487,8 +487,8 @@ pgarch_ArchiverCopyLoop(void)
else else
{ {
/* /*
* Tell the collector about the WAL file that we failed to * Tell the cumulative stats system about the WAL file that we
* archive * failed to archive
*/ */
pgstat_send_archiver(xlog, true); pgstat_send_archiver(xlog, true);

View File

@ -693,9 +693,9 @@ allow_immediate_pgstat_restart(void)
/* /*
* Shut down a single backend's statistics reporting at process exit. * Shut down a single backend's statistics reporting at process exit.
* *
* Flush any remaining statistics counts out to the collector. * Flush out any remaining statistics counts. Without this, operations
* Without this, operations triggered during backend exit (such as * triggered during backend exit (such as temp table deletions) won't be
* temp table deletions) won't be counted. * counted.
*/ */
static void static void
pgstat_shutdown_hook(int code, Datum arg) pgstat_shutdown_hook(int code, Datum arg)
@ -703,10 +703,10 @@ pgstat_shutdown_hook(int code, Datum arg)
Assert(!pgstat_is_shutdown); Assert(!pgstat_is_shutdown);
/* /*
* If we got as far as discovering our own database ID, we can report what * If we got as far as discovering our own database ID, we can flush out
* we did to the collector. Otherwise, we'd be sending an invalid * what we did so far. Otherwise, we'd be reporting an invalid database
* database ID, so forget it. (This means that accesses to pg_database * ID, so forget it. (This means that accesses to pg_database during
* during failed backend starts might never get counted.) * failed backend starts might never get counted.)
*/ */
if (OidIsValid(MyDatabaseId)) if (OidIsValid(MyDatabaseId))
pgstat_report_stat(true); 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 * Permission checking for this function is managed through the normal
* GRANT system. * 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 * Permission checking for this function is managed through the normal
* GRANT system. * 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 * Permission checking for this function is managed through the normal
* GRANT system. * GRANT system.
@ -1198,8 +1198,8 @@ pgstat_clear_snapshot(void)
/* /*
* Support function for the SQL-callable pgstat* functions. Returns * Support function for the SQL-callable pgstat* functions. Returns
* the collected statistics for one database or NULL. NULL doesn't mean * 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 * that the database doesn't exist, just that there are no statistics, so the
* collector, so the caller is better off to report ZERO instead. * caller is better off to report ZERO instead.
*/ */
PgStat_StatDBEntry * PgStat_StatDBEntry *
pgstat_fetch_stat_dbentry(Oid dbid) pgstat_fetch_stat_dbentry(Oid dbid)
@ -1233,8 +1233,8 @@ pgstat_fetch_global(void)
/* /*
* Support function for the SQL-callable pgstat* functions. Returns * Support function for the SQL-callable pgstat* functions. Returns
* the collected statistics for one table or NULL. NULL doesn't mean * 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 * that the table doesn't exist, just that there are no statistics, so the
* collector, so the caller is better off to report ZERO instead. * caller is better off to report ZERO instead.
*/ */
PgStat_StatTabEntry * PgStat_StatTabEntry *
pgstat_fetch_stat_tabentry(Oid relid) pgstat_fetch_stat_tabentry(Oid relid)

View File

@ -257,7 +257,7 @@ WalWriterMain(void)
else if (left_till_hibernate > 0) else if (left_till_hibernate > 0)
left_till_hibernate--; left_till_hibernate--;
/* Send WAL statistics to the stats collector */ /* report pending statistics to the cumulative stats system */
pgstat_send_wal(false); pgstat_send_wal(false);
/* /*
@ -295,12 +295,11 @@ HandleWalWriterInterrupts(void)
if (ShutdownRequestPending) if (ShutdownRequestPending)
{ {
/* /*
* Force to send remaining WAL statistics to the stats collector at * Force reporting remaining WAL statistics at process exit.
* process exit.
* *
* Since pgstat_send_wal is invoked with 'force' is false in main loop * Since pgstat_send_wal is invoked with 'force' is false in main loop
* to avoid overloading to the stats collector, there may exist unsent * to avoid overloading the cumulative stats system, there may exist
* stats counters for the WAL writer. * unreported stats counters for the WAL writer.
*/ */
pgstat_send_wal(true); pgstat_send_wal(true);

View 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 '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 * If dboid is anything other than InvalidOid then any checksum failures
* will get reported to the stats collector. * detected will get reported to the cumulative stats system.
* *
* Returns true if the file was successfully sent, false if 'missing_ok', * Returns true if the file was successfully sent, false if 'missing_ok',
* and the file did not exist. * and the file did not exist.

View File

@ -2937,7 +2937,7 @@ die(SIGNAL_ARGS)
ProcDiePending = true; ProcDiePending = true;
} }
/* for the statistics collector */ /* for the cumulative stats system */
pgStatSessionEndCause = DISCONNECT_KILLED; pgStatSessionEndCause = DISCONNECT_KILLED;
/* If we're still here, waken anything waiting on the process latch */ /* 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. * Note: this includes fflush()'ing the last of the prior output.
* *
* This is also a good time to send collected statistics to the * This is also a good time to flush out collected statistics to the
* collector, and to update the PS stats display. We avoid doing * 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 * those every time through the message loop because it'd slow down
* processing of batched messages, and because we don't want to report * processing of batched messages, and because we don't want to report
* uncommitted updates (that confuses autovacuum). The notification * uncommitted updates (that confuses autovacuum). The notification
@ -4710,7 +4710,7 @@ PostgresMain(const char *dbname, const char *username)
*/ */
case EOF: case EOF:
/* for the statistics collector */ /* for the cumulative statistics system */
pgStatSessionEndCause = DISCONNECT_CLIENT_EOF; pgStatSessionEndCause = DISCONNECT_CLIENT_EOF;
/* FALLTHROUGH */ /* FALLTHROUGH */

View File

@ -22,8 +22,7 @@
/* /*
* Tell the collector about the WAL file that we successfully * Report archiver statistics
* archived or failed to archive.
*/ */
void void
pgstat_send_archiver(const char *xlog, bool failed) pgstat_send_archiver(const char *xlog, bool failed)

View File

@ -29,7 +29,7 @@ PgStat_MsgBgWriter PendingBgWriterStats;
/* /*
* Send bgwriter statistics to the collector * Report bgwriter statistics
*/ */
void void
pgstat_send_bgwriter(void) pgstat_send_bgwriter(void)

View File

@ -29,7 +29,7 @@ PgStat_MsgCheckpointer PendingCheckpointerStats;
/* /*
* Send checkpointer statistics to the collector * Report checkpointer statistics
*/ */
void void
pgstat_send_checkpointer(void) pgstat_send_checkpointer(void)

View 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 void
pgstat_report_recovery_conflict(int reason) 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 void
pgstat_report_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 void
pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount) 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 void
pgstat_report_checksum_failure(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 void
pgstat_report_tempfile(size_t filesize) 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 void
pgstat_report_connect(Oid dboid) 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 void
pgstat_report_disconnect(Oid dboid) pgstat_report_disconnect(Oid dboid)

View File

@ -168,7 +168,7 @@ pgstat_drop_relation(Oid relid)
#endif /* NOT_USED */ #endif /* NOT_USED */
/* /*
* Tell the collector about the table we just vacuumed. * Report that the table was just vacuumed.
*/ */
void void
pgstat_report_vacuum(Oid tableoid, bool shared, 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 * Caller must provide new live- and dead-tuples estimates, as well as a
* flag indicating whether to reset the changes_since_analyze counter. * 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 * already inserted and/or deleted rows in the target table. ANALYZE will
* have counted such rows as live or dead respectively. Because we 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 * 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 * off these counts from the update we're making now, else they'll be
* be double-counted after commit. (This approach also ensures that the * double-counted after commit. (This approach also ensures that the
* collector ends up with the right numbers if we abort instead of * shared stats entry ends up with the right numbers if we abort instead
* committing.) * of committing.)
* *
* Waste no time on partitioned tables, though. * 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 * All we need do here is unlink the transaction stats state from the
* nontransactional state. The nontransactional action counts will be * nontransactional state. The nontransactional action counts will be
* reported to the stats collector immediately, while the effects on * reported to the stats system immediately, while the effects on live and
* live and dead tuple counts are preserved in the 2PC state file. * dead tuple counts are preserved in the 2PC state file.
* *
* Note: AtEOXact_PgStat_Relations is not called during PREPARE. * Note: AtEOXact_PgStat_Relations is not called during PREPARE.
*/ */

View File

@ -23,8 +23,8 @@
/* /*
* Tell the statistics collector to reset a single replication slot * Reset counters for a single replication slot, or all replication slots
* counter, or all replication slots counters (when name is null). * (when name is null).
* *
* Permission checking for this function is managed through the normal * Permission checking for this function is managed through the normal
* GRANT system. * 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 void
pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat) 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 void
pgstat_report_replslot_create(const char *slotname) 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 void
pgstat_report_replslot_drop(const char *slotname) pgstat_report_replslot_drop(const char *slotname)

View File

@ -33,8 +33,7 @@ static PgStat_MsgSLRU SLRUStats[SLRU_NUM_ELEMENTS];
/* /*
* Tell the statistics collector to reset a single SLRU counter, or all * Reset counters for a single SLRU, or all SLRUs (when name is null).
* SLRU counters (when name is null).
* *
* Permission checking for this function is managed through the normal * Permission checking for this function is managed through the normal
* GRANT system. * GRANT system.

View File

@ -21,8 +21,8 @@
/* /*
* Tell the statistics collector to reset a single subscription * Reset counters for a single subscription, or all subscriptions (when subid
* counter, or all subscription counters (when subid is InvalidOid). * is InvalidOid).
* *
* Permission checking for this function is managed through the normal * Permission checking for this function is managed through the normal
* GRANT system. * GRANT system.
@ -42,7 +42,7 @@ pgstat_reset_subscription_counter(Oid subid)
} }
/* /*
* Tell the collector about the subscription error. * Report a subscription error.
*/ */
void void
pgstat_report_subscription_error(Oid subid, bool is_apply_error) 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 void
pgstat_report_subscription_drop(Oid subid) pgstat_report_subscription_drop(Oid subid)

View File

@ -1,7 +1,7 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* pgstatfuncs.c * 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) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
@ -1820,7 +1820,7 @@ pg_stat_get_slru(PG_FUNCTION_ARGS)
SetSingleFuncCall(fcinfo, 0); SetSingleFuncCall(fcinfo, 0);
/* request SLRU stats from the stat collector */ /* request SLRU stats from the cumulative stats system */
stats = pgstat_fetch_slru(); stats = pgstat_fetch_slru();
for (i = 0;; i++) for (i = 0;; i++)

View File

@ -647,7 +647,7 @@ errfinish(const char *filename, int lineno, const char *funcname)
fflush(stderr); 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. * terminated by fatal error if there is no other known cause.
*/ */
if (pgStatSessionEndCause == DISCONNECT_NORMAL) if (pgStatSessionEndCause == DISCONNECT_NORMAL)

View File

@ -1,7 +1,7 @@
/* ---------- /* ----------
* pgstat.h * pgstat.h
* *
* Definitions for the PostgreSQL statistics collector daemon. * Definitions for the PostgreSQL cumulative statistics system.
* *
* Copyright (c) 2001-2022, PostgreSQL Global Development Group * 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. * 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 * 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 typedef struct PgStat_FunctionCounts

View File

@ -85,8 +85,8 @@ typedef struct PgBackendGSSStatus
* *
* Each live backend maintains a PgBackendStatus struct in shared memory * Each live backend maintains a PgBackendStatus struct in shared memory
* showing its current activity. (The structs are allocated according to * showing its current activity. (The structs are allocated according to
* BackendId, but that is not critical.) Note that the collector process * BackendId, but that is not critical.) Note that this is unrelated to the
* has no involvement in, or even access to, these structs. * cumulative stats system (i.e. pgstat.c et al).
* *
* Each auxiliary process also maintains a PgBackendStatus struct in shared * Each auxiliary process also maintains a PgBackendStatus struct in shared
* memory. * memory.

View File

@ -1,7 +1,7 @@
/* ---------- /* ----------
* pgstat_internal.h * 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 * only be needed by files implementing statistics support (rather than ones
* reporting / querying stats). * reporting / querying stats).
* *

View File

@ -1,5 +1,5 @@
-- --
-- Test Statistics Collector -- Test cumulative stats system
-- --
-- Must be run after tenk2 has been created (by create_table), -- Must be run after tenk2 has been created (by create_table),
-- populated (by create_misc) and indexed (by create_index). -- populated (by create_misc) and indexed (by create_index).

View File

@ -1,5 +1,5 @@
-- --
-- Test Statistics Collector -- Test cumulative stats system
-- --
-- Must be run after tenk2 has been created (by create_table), -- Must be run after tenk2 has been created (by create_table),
-- populated (by create_misc) and indexed (by create_index). -- populated (by create_misc) and indexed (by create_index).