# 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;
* 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)))
{
&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
* 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.
*/
}
/*
- * 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.)
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);
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)
* 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
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
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();
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
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();
*
* 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.
*
*
* 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
*/
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())
/* 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);
/*
* 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);
CheckArchiveTimeout();
- /*
- * Report interim activity statistics.
- */
+ /* Report interim statistics to the cumulative stats system */
pgstat_send_checkpointer();
/*
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);
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);
/*
* 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)
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);
}
/*
- * 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.
}
/*
- * 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.
}
/*
- * 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.
/*
* 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)
/*
* 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)
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);
/*
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);
*
* 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.
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 */
*
* 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
*/
case EOF:
- /* for the statistics collector */
+ /* for the cumulative statistics system */
pgStatSessionEndCause = DISCONNECT_CLIENT_EOF;
/* FALLTHROUGH */
/*
- * 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)
/*
- * Send bgwriter statistics to the collector
+ * Report bgwriter statistics
*/
void
pgstat_send_bgwriter(void)
/*
- * Send checkpointer statistics to the collector
+ * Report checkpointer statistics
*/
void
pgstat_send_checkpointer(void)
}
/*
- * Tell the collector about a Hot Standby recovery conflict.
+ * Report a Hot Standby recovery conflict.
*/
void
pgstat_report_recovery_conflict(int reason)
}
/*
- * Tell the collector about a deadlock detected.
+ * Report a detected deadlock.
*/
void
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)
}
/*
- * Tell the collector about a checksum failure.
+ * Report one checksum failure in the current database.
*/
void
pgstat_report_checksum_failure(void)
}
/*
- * Tell the collector about a temporary file.
+ * Report creation of temporary file.
*/
void
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)
}
/*
- * Tell the collector about a disconnect.
+ * Notify the stats system of a disconnect.
*/
void
pgstat_report_disconnect(Oid dboid)
#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,
}
/*
- * 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.
* 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.
*/
/*
* 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.
*/
/*
- * 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.
}
/*
- * Tell the collector about replication slot statistics.
+ * Report replication slot statistics.
*/
void
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)
}
/*
- * Tell the collector about dropping the replication slot.
+ * Report replication slot drop.
*/
void
pgstat_report_replslot_drop(const char *slotname)
/*
- * 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.
/*
- * 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.
}
/*
- * Tell the collector about the subscription error.
+ * Report a subscription error.
*/
void
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)
/*-------------------------------------------------------------------------
*
* 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
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++)
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)
/* ----------
* pgstat.h
*
- * Definitions for the PostgreSQL statistics collector daemon.
+ * Definitions for the PostgreSQL cumulative statistics system.
*
* Copyright (c) 2001-2022, PostgreSQL Global Development Group
*
* 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
*
* 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.
/* ----------
* 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).
*
--
--- 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).
--
--- 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).