mirror of
https://github.com/postgres/postgres.git
synced 2025-06-08 00:01:54 -04:00
pgstat: consistent function comment formatting.
There was a wild mishmash of function comment formatting in pgstat, making it hard to know what to use for any new function and hard to extend existing comments (particularly due to randomly different forms of indentation). Author: Andres Freund <andres@anarazel.de> Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220329191727.mzzwbl7udhpq7pmf@alap3.anarazel.de Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de
This commit is contained in:
parent
4e34747c88
commit
edadf8098f
@ -240,14 +240,11 @@ static bool pgstat_is_shutdown = false;
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_init() -
|
|
||||||
*
|
|
||||||
* Called from postmaster at startup. Create the resources required
|
* Called from postmaster at startup. Create the resources required
|
||||||
* by the statistics collector process. If unable to do so, do not
|
* by the statistics collector process. If unable to do so, do not
|
||||||
* fail --- better to let the postmaster start with stats collection
|
* fail --- better to let the postmaster start with stats collection
|
||||||
* disabled.
|
* disabled.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_init(void)
|
pgstat_init(void)
|
||||||
@ -579,8 +576,6 @@ pgstat_reset_remove_files(const char *directory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_reset_all() -
|
|
||||||
*
|
|
||||||
* Remove the stats files. This is currently used only if WAL
|
* Remove the stats files. This is currently used only if WAL
|
||||||
* recovery is needed after a crash.
|
* recovery is needed after a crash.
|
||||||
*/
|
*/
|
||||||
@ -594,8 +589,6 @@ pgstat_reset_all(void)
|
|||||||
#ifdef EXEC_BACKEND
|
#ifdef EXEC_BACKEND
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_forkexec() -
|
|
||||||
*
|
|
||||||
* Format up the arglist for, then fork and exec, statistics collector process
|
* Format up the arglist for, then fork and exec, statistics collector process
|
||||||
*/
|
*/
|
||||||
static pid_t
|
static pid_t
|
||||||
@ -617,8 +610,6 @@ pgstat_forkexec(void)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_start() -
|
|
||||||
*
|
|
||||||
* Called from postmaster at startup or after an existing collector
|
* Called from postmaster at startup or after an existing collector
|
||||||
* died. Attempt to fire up a fresh statistics collector.
|
* died. Attempt to fire up a fresh statistics collector.
|
||||||
*
|
*
|
||||||
@ -727,14 +718,11 @@ pgstat_shutdown_hook(int code, Datum arg)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_initialize() -
|
|
||||||
*
|
|
||||||
* Initialize pgstats state, and set up our on-proc-exit hook. Called from
|
* Initialize pgstats state, and set up our on-proc-exit hook. Called from
|
||||||
* BaseInit().
|
* BaseInit().
|
||||||
*
|
*
|
||||||
* NOTE: MyDatabaseId isn't set yet; so the shutdown hook has to be careful.
|
* NOTE: MyDatabaseId isn't set yet; so the shutdown hook has to be careful.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_initialize(void)
|
pgstat_initialize(void)
|
||||||
@ -757,11 +745,8 @@ pgstat_initialize(void)
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* AtEOXact_PgStat
|
|
||||||
*
|
|
||||||
* Called from access/transam/xact.c at top-level transaction commit/abort.
|
* Called from access/transam/xact.c at top-level transaction commit/abort.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
AtEOXact_PgStat(bool isCommit, bool parallel)
|
AtEOXact_PgStat(bool isCommit, bool parallel)
|
||||||
@ -785,11 +770,8 @@ AtEOXact_PgStat(bool isCommit, bool parallel)
|
|||||||
pgstat_clear_snapshot();
|
pgstat_clear_snapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* AtEOSubXact_PgStat
|
|
||||||
*
|
|
||||||
* Called from access/transam/xact.c at subtransaction commit/abort.
|
* Called from access/transam/xact.c at subtransaction commit/abort.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
AtEOSubXact_PgStat(bool isCommit, int nestDepth)
|
AtEOSubXact_PgStat(bool isCommit, int nestDepth)
|
||||||
@ -811,7 +793,6 @@ AtEOSubXact_PgStat(bool isCommit, int nestDepth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AtPrepare_PgStat
|
|
||||||
* Save the transactional stats state at 2PC transaction prepare.
|
* Save the transactional stats state at 2PC transaction prepare.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@ -830,7 +811,6 @@ AtPrepare_PgStat(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PostPrepare_PgStat
|
|
||||||
* Clean up after successful PREPARE.
|
* Clean up after successful PREPARE.
|
||||||
*
|
*
|
||||||
* Note: AtEOXact_PgStat is not called during PREPARE.
|
* Note: AtEOXact_PgStat is not called during PREPARE.
|
||||||
@ -858,15 +838,12 @@ PostPrepare_PgStat(void)
|
|||||||
pgstat_clear_snapshot();
|
pgstat_clear_snapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_clear_snapshot() -
|
|
||||||
*
|
|
||||||
* Discard any data collected in the current transaction. Any subsequent
|
* Discard any data collected in the current transaction. Any subsequent
|
||||||
* request will cause new snapshots to be read.
|
* request will cause new snapshots to be read.
|
||||||
*
|
*
|
||||||
* This is also invoked during transaction commit or abort to discard
|
* This is also invoked during transaction commit or abort to discard
|
||||||
* the no-longer-wanted snapshot.
|
* the no-longer-wanted snapshot.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_clear_snapshot(void)
|
pgstat_clear_snapshot(void)
|
||||||
@ -920,9 +897,7 @@ pgstat_xact_stack_level_get(int nest_level)
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_report_stat() -
|
|
||||||
*
|
|
||||||
* Must be called by processes that performs DML: tcop/postgres.c, logical
|
* Must be called by processes that performs DML: tcop/postgres.c, logical
|
||||||
* receiver processes, SPI worker, etc. to send the so far collected
|
* receiver processes, SPI worker, etc. to send the so far collected
|
||||||
* per-table and function usage statistics to the collector. Note that this
|
* per-table and function usage statistics to the collector. Note that this
|
||||||
@ -932,7 +907,6 @@ pgstat_xact_stack_level_get(int nest_level)
|
|||||||
* "disconnect" is "true" only for the last call before the backend
|
* "disconnect" is "true" only for the last call before the backend
|
||||||
* exits. This makes sure that no data is lost and that interrupted
|
* exits. This makes sure that no data is lost and that interrupted
|
||||||
* sessions are reported correctly.
|
* sessions are reported correctly.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_stat(bool disconnect)
|
pgstat_report_stat(bool disconnect)
|
||||||
@ -979,11 +953,8 @@ pgstat_report_stat(bool disconnect)
|
|||||||
pgstat_send_slru();
|
pgstat_send_slru();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_vacuum_stat() -
|
|
||||||
*
|
|
||||||
* Will tell the collector about objects he can get rid of.
|
* Will tell the collector about objects he can get rid of.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_vacuum_stat(void)
|
pgstat_vacuum_stat(void)
|
||||||
@ -1201,14 +1172,11 @@ pgstat_vacuum_stat(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_collect_oids() -
|
|
||||||
*
|
|
||||||
* Collect the OIDs of all objects listed in the specified system catalog
|
* Collect the OIDs of all objects listed in the specified system catalog
|
||||||
* into a temporary hash table. Caller should hash_destroy the result
|
* into a temporary hash table. Caller should hash_destroy the result
|
||||||
* when done with it. (However, we make the table in CurrentMemoryContext
|
* when done with it. (However, we make the table in CurrentMemoryContext
|
||||||
* so that it will be freed properly in event of an error.)
|
* so that it will be freed properly in event of an error.)
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static HTAB *
|
static HTAB *
|
||||||
pgstat_collect_oids(Oid catalogid, AttrNumber anum_oid)
|
pgstat_collect_oids(Oid catalogid, AttrNumber anum_oid)
|
||||||
@ -1250,14 +1218,11 @@ pgstat_collect_oids(Oid catalogid, AttrNumber anum_oid)
|
|||||||
return htab;
|
return htab;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_counters() -
|
|
||||||
*
|
|
||||||
* Tell the statistics collector to reset counters for our database.
|
* Tell the statistics collector to 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.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_reset_counters(void)
|
pgstat_reset_counters(void)
|
||||||
@ -1272,14 +1237,11 @@ pgstat_reset_counters(void)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_single_counter() -
|
|
||||||
*
|
|
||||||
* Tell the statistics collector to reset a single counter.
|
* Tell the statistics collector to 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.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_reset_single_counter(Oid objoid, PgStat_Single_Reset_Type type)
|
pgstat_reset_single_counter(Oid objoid, PgStat_Single_Reset_Type type)
|
||||||
@ -1297,14 +1259,11 @@ pgstat_reset_single_counter(Oid objoid, PgStat_Single_Reset_Type type)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_shared_counters() -
|
|
||||||
*
|
|
||||||
* Tell the statistics collector to reset cluster-wide shared counters.
|
* Tell the statistics collector to 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.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_reset_shared_counters(const char *target)
|
pgstat_reset_shared_counters(const char *target)
|
||||||
@ -1330,11 +1289,8 @@ pgstat_reset_shared_counters(const char *target)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_ping() -
|
|
||||||
*
|
|
||||||
* Send some junk data to the collector to increase traffic.
|
* Send some junk data to the collector to increase traffic.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_ping(void)
|
pgstat_ping(void)
|
||||||
@ -1348,11 +1304,8 @@ pgstat_ping(void)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_send_inquiry() -
|
|
||||||
*
|
|
||||||
* Notify collector that we need fresh data.
|
* Notify collector that we need fresh data.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_send_inquiry(TimestampTz clock_time, TimestampTz cutoff_time, Oid databaseid)
|
pgstat_send_inquiry(TimestampTz clock_time, TimestampTz cutoff_time, Oid databaseid)
|
||||||
@ -1366,14 +1319,11 @@ pgstat_send_inquiry(TimestampTz clock_time, TimestampTz cutoff_time, Oid databas
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_fetch_stat_dbentry() -
|
|
||||||
*
|
|
||||||
* 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, it is just not yet known by the
|
||||||
* collector, so the caller is better off to report ZERO instead.
|
* collector, so the caller is better off to report ZERO instead.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
PgStat_StatDBEntry *
|
PgStat_StatDBEntry *
|
||||||
pgstat_fetch_stat_dbentry(Oid dbid)
|
pgstat_fetch_stat_dbentry(Oid dbid)
|
||||||
@ -1393,12 +1343,8 @@ pgstat_fetch_stat_dbentry(Oid dbid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_global() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* a pointer to the global statistics struct.
|
* a pointer to the global statistics struct.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_GlobalStats *
|
PgStat_GlobalStats *
|
||||||
pgstat_fetch_global(void)
|
pgstat_fetch_global(void)
|
||||||
@ -1408,14 +1354,11 @@ pgstat_fetch_global(void)
|
|||||||
return &globalStats;
|
return &globalStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_fetch_stat_tabentry() -
|
|
||||||
*
|
|
||||||
* 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, it is just not yet known by the
|
||||||
* collector, so the caller is better off to report ZERO instead.
|
* collector, so the caller is better off to report ZERO instead.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
PgStat_StatTabEntry *
|
PgStat_StatTabEntry *
|
||||||
pgstat_fetch_stat_tabentry(Oid relid)
|
pgstat_fetch_stat_tabentry(Oid relid)
|
||||||
@ -1466,12 +1409,9 @@ pgstat_fetch_stat_tabentry(Oid relid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_fetch_stat_funcentry() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* the collected statistics for one function or NULL.
|
* the collected statistics for one function or NULL.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
PgStat_StatFuncEntry *
|
PgStat_StatFuncEntry *
|
||||||
pgstat_fetch_stat_funcentry(Oid func_id)
|
pgstat_fetch_stat_funcentry(Oid func_id)
|
||||||
@ -1495,12 +1435,8 @@ pgstat_fetch_stat_funcentry(Oid func_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_stat_archiver() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* a pointer to the archiver statistics struct.
|
* a pointer to the archiver statistics struct.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_ArchiverStats *
|
PgStat_ArchiverStats *
|
||||||
pgstat_fetch_stat_archiver(void)
|
pgstat_fetch_stat_archiver(void)
|
||||||
@ -1511,12 +1447,8 @@ pgstat_fetch_stat_archiver(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_stat_bgwriter() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* a pointer to the bgwriter statistics struct.
|
* a pointer to the bgwriter statistics struct.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_BgWriterStats *
|
PgStat_BgWriterStats *
|
||||||
pgstat_fetch_stat_bgwriter(void)
|
pgstat_fetch_stat_bgwriter(void)
|
||||||
@ -1527,12 +1459,8 @@ pgstat_fetch_stat_bgwriter(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_stat_checkpointer() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* a pointer to the checkpointer statistics struct.
|
* a pointer to the checkpointer statistics struct.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_CheckpointerStats *
|
PgStat_CheckpointerStats *
|
||||||
pgstat_fetch_stat_checkpointer(void)
|
pgstat_fetch_stat_checkpointer(void)
|
||||||
@ -1543,12 +1471,8 @@ pgstat_fetch_stat_checkpointer(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_stat_wal() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* a pointer to the WAL statistics struct.
|
* a pointer to the WAL statistics struct.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_WalStats *
|
PgStat_WalStats *
|
||||||
pgstat_fetch_stat_wal(void)
|
pgstat_fetch_stat_wal(void)
|
||||||
@ -1559,12 +1483,8 @@ pgstat_fetch_stat_wal(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_slru() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* a pointer to the slru statistics struct.
|
* a pointer to the slru statistics struct.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_SLRUStats *
|
PgStat_SLRUStats *
|
||||||
pgstat_fetch_slru(void)
|
pgstat_fetch_slru(void)
|
||||||
@ -1575,12 +1495,8 @@ pgstat_fetch_slru(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_replslot() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* a pointer to the replication slot statistics struct.
|
* a pointer to the replication slot statistics struct.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_StatReplSlotEntry *
|
PgStat_StatReplSlotEntry *
|
||||||
pgstat_fetch_replslot(NameData slotname)
|
pgstat_fetch_replslot(NameData slotname)
|
||||||
@ -1591,12 +1507,8 @@ pgstat_fetch_replslot(NameData slotname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------
|
|
||||||
* pgstat_fetch_stat_subscription() -
|
|
||||||
*
|
|
||||||
* Support function for the SQL-callable pgstat* functions. Returns
|
* Support function for the SQL-callable pgstat* functions. Returns
|
||||||
* the collected statistics for one subscription or NULL.
|
* the collected statistics for one subscription or NULL.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
PgStat_StatSubEntry *
|
PgStat_StatSubEntry *
|
||||||
pgstat_fetch_stat_subscription(Oid subid)
|
pgstat_fetch_stat_subscription(Oid subid)
|
||||||
@ -1613,11 +1525,8 @@ pgstat_fetch_stat_subscription(Oid subid)
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_setup_memcxt() -
|
|
||||||
*
|
|
||||||
* Create pgStatLocalContext, if not already done.
|
* Create pgStatLocalContext, if not already done.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_setup_memcxt(void)
|
pgstat_setup_memcxt(void)
|
||||||
@ -1641,11 +1550,8 @@ pgstat_assert_is_up(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_setheader() -
|
|
||||||
*
|
|
||||||
* Set common header fields in a statistics message
|
* Set common header fields in a statistics message
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_setheader(PgStat_MsgHdr *hdr, StatMsgType mtype)
|
pgstat_setheader(PgStat_MsgHdr *hdr, StatMsgType mtype)
|
||||||
@ -1654,11 +1560,8 @@ pgstat_setheader(PgStat_MsgHdr *hdr, StatMsgType mtype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_send() -
|
|
||||||
*
|
|
||||||
* Send out one statistics message to the collector
|
* Send out one statistics message to the collector
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_send(void *msg, int len)
|
pgstat_send(void *msg, int len)
|
||||||
@ -1685,14 +1588,11 @@ pgstat_send(void *msg, int len)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* PgstatCollectorMain() -
|
|
||||||
*
|
|
||||||
* Start up the statistics collector process. This is the body of the
|
* Start up the statistics collector process. This is the body of the
|
||||||
* postmaster child process.
|
* postmaster child process.
|
||||||
*
|
*
|
||||||
* The argc/argv parameters are valid only in EXEC_BACKEND case.
|
* The argc/argv parameters are valid only in EXEC_BACKEND case.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
NON_EXEC_STATIC void
|
NON_EXEC_STATIC void
|
||||||
PgstatCollectorMain(int argc, char *argv[])
|
PgstatCollectorMain(int argc, char *argv[])
|
||||||
@ -2131,14 +2031,11 @@ pgstat_get_tab_entry(PgStat_StatDBEntry *dbentry, Oid tableoid, bool create)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_get_replslot_entry
|
|
||||||
*
|
|
||||||
* Return the entry of replication slot stats with the given name. Return
|
* Return the entry of replication slot stats with the given name. Return
|
||||||
* NULL if not found and the caller didn't request to create it.
|
* NULL if not found and the caller didn't request to create it.
|
||||||
*
|
*
|
||||||
* create tells whether to create the new slot entry if it is not found.
|
* create tells whether to create the new slot entry if it is not found.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static PgStat_StatReplSlotEntry *
|
static PgStat_StatReplSlotEntry *
|
||||||
pgstat_get_replslot_entry(NameData name, bool create)
|
pgstat_get_replslot_entry(NameData name, bool create)
|
||||||
@ -2187,11 +2084,8 @@ pgstat_get_replslot_entry(NameData name, bool create)
|
|||||||
return slotent;
|
return slotent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_replslot
|
|
||||||
*
|
|
||||||
* Reset the given replication slot stats.
|
* Reset the given replication slot stats.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_reset_replslot(PgStat_StatReplSlotEntry *slotent, TimestampTz ts)
|
pgstat_reset_replslot(PgStat_StatReplSlotEntry *slotent, TimestampTz ts)
|
||||||
@ -2208,13 +2102,10 @@ pgstat_reset_replslot(PgStat_StatReplSlotEntry *slotent, TimestampTz ts)
|
|||||||
slotent->stat_reset_timestamp = ts;
|
slotent->stat_reset_timestamp = ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_get_subscription_entry
|
|
||||||
*
|
|
||||||
* Return the subscription statistics entry with the given subscription OID.
|
* Return the subscription statistics entry with the given subscription OID.
|
||||||
* If no subscription entry exists, initialize it, if the create parameter is
|
* If no subscription entry exists, initialize it, if the create parameter is
|
||||||
* true. Else, return NULL.
|
* true. Else, return NULL.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static PgStat_StatSubEntry *
|
static PgStat_StatSubEntry *
|
||||||
pgstat_get_subscription_entry(Oid subid, bool create)
|
pgstat_get_subscription_entry(Oid subid, bool create)
|
||||||
@ -2256,11 +2147,8 @@ pgstat_get_subscription_entry(Oid subid, bool create)
|
|||||||
return subentry;
|
return subentry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_subscription
|
|
||||||
*
|
|
||||||
* Reset the given subscription stats.
|
* Reset the given subscription stats.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_reset_subscription(PgStat_StatSubEntry *subentry, TimestampTz ts)
|
pgstat_reset_subscription(PgStat_StatSubEntry *subentry, TimestampTz ts)
|
||||||
@ -2276,8 +2164,7 @@ pgstat_reset_subscription(PgStat_StatSubEntry *subentry, TimestampTz ts)
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_write_statsfiles() -
|
|
||||||
* Write the global statistics file, as well as requested DB files.
|
* Write the global statistics file, as well as requested DB files.
|
||||||
*
|
*
|
||||||
* 'permanent' specifies writing to the permanent files not temporary ones.
|
* 'permanent' specifies writing to the permanent files not temporary ones.
|
||||||
@ -2288,7 +2175,6 @@ pgstat_reset_subscription(PgStat_StatSubEntry *subentry, TimestampTz ts)
|
|||||||
* When 'allDbs' is false, only the requested databases (listed in
|
* When 'allDbs' is false, only the requested databases (listed in
|
||||||
* pending_write_requests) will be written; otherwise, all databases
|
* pending_write_requests) will be written; otherwise, all databases
|
||||||
* will be written.
|
* will be written.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_write_statsfiles(bool permanent, bool allDbs)
|
pgstat_write_statsfiles(bool permanent, bool allDbs)
|
||||||
@ -2475,15 +2361,13 @@ get_dbstat_filename(bool permanent, bool tempname, Oid databaseid,
|
|||||||
elog(ERROR, "overlength pgstat path");
|
elog(ERROR, "overlength pgstat path");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_write_db_statsfile() -
|
|
||||||
* Write the stat file for a single database.
|
* Write the stat file for a single database.
|
||||||
*
|
*
|
||||||
* If writing to the permanent file (happens when the collector is
|
* If writing to the permanent file (happens when the collector is
|
||||||
* shutting down only), remove the temporary file so that backends
|
* shutting down only), remove the temporary file so that backends
|
||||||
* starting up under a new postmaster can't read the old data before
|
* starting up under a new postmaster can't read the old data before
|
||||||
* the new collector is ready.
|
* the new collector is ready.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent)
|
pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent)
|
||||||
@ -2588,9 +2472,7 @@ pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_read_statsfiles() -
|
|
||||||
*
|
|
||||||
* Reads in some existing statistics collector files and returns the
|
* Reads in some existing statistics collector files and returns the
|
||||||
* databases hash table that is the top level of the data.
|
* databases hash table that is the top level of the data.
|
||||||
*
|
*
|
||||||
@ -2606,7 +2488,6 @@ pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent)
|
|||||||
*
|
*
|
||||||
* If a 'deep' read is requested, table/function stats are read, otherwise
|
* If a 'deep' read is requested, table/function stats are read, otherwise
|
||||||
* the table/function hash tables remain empty.
|
* the table/function hash tables remain empty.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static HTAB *
|
static HTAB *
|
||||||
pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep)
|
pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep)
|
||||||
@ -2936,9 +2817,7 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_read_db_statsfile() -
|
|
||||||
*
|
|
||||||
* Reads in the existing statistics collector file for the given database,
|
* Reads in the existing statistics collector file for the given database,
|
||||||
* filling the passed-in tables and functions hash tables.
|
* filling the passed-in tables and functions hash tables.
|
||||||
*
|
*
|
||||||
@ -2948,7 +2827,6 @@ done:
|
|||||||
* Note: this code has the ability to skip storing per-table or per-function
|
* Note: this code has the ability to skip storing per-table or per-function
|
||||||
* data, if NULL is passed for the corresponding hashtable. That's not used
|
* data, if NULL is passed for the corresponding hashtable. That's not used
|
||||||
* at the moment though.
|
* at the moment though.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_read_db_statsfile(Oid databaseid, HTAB *tabhash, HTAB *funchash,
|
pgstat_read_db_statsfile(Oid databaseid, HTAB *tabhash, HTAB *funchash,
|
||||||
@ -3095,9 +2973,7 @@ done:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_read_db_statsfile_timestamp() -
|
|
||||||
*
|
|
||||||
* Attempt to determine the timestamp of the last db statfile write.
|
* Attempt to determine the timestamp of the last db statfile write.
|
||||||
* Returns true if successful; the timestamp is stored in *ts. The caller must
|
* Returns true if successful; the timestamp is stored in *ts. The caller must
|
||||||
* rely on timestamp stored in *ts iff the function returns true.
|
* rely on timestamp stored in *ts iff the function returns true.
|
||||||
@ -3111,7 +2987,6 @@ done:
|
|||||||
* - if there's no db stat entry (e.g. for a new or inactive database),
|
* - if there's no db stat entry (e.g. for a new or inactive database),
|
||||||
* there's no stats_timestamp value, but also nothing to write so we return
|
* there's no stats_timestamp value, but also nothing to write so we return
|
||||||
* the timestamp of the global statfile.
|
* the timestamp of the global statfile.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent,
|
pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent,
|
||||||
@ -3424,11 +3299,8 @@ backend_read_statsfile(void)
|
|||||||
pgStatDBHash = pgstat_read_statsfiles(MyDatabaseId, false, true);
|
pgStatDBHash = pgstat_read_statsfiles(MyDatabaseId, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_write_statsfile_needed() -
|
|
||||||
*
|
|
||||||
* Do we need to write out any stats files?
|
* Do we need to write out any stats files?
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
pgstat_write_statsfile_needed(void)
|
pgstat_write_statsfile_needed(void)
|
||||||
@ -3440,11 +3312,8 @@ pgstat_write_statsfile_needed(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_db_requested() -
|
|
||||||
*
|
|
||||||
* Checks whether stats for a particular DB need to be written to a file.
|
* Checks whether stats for a particular DB need to be written to a file.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
pgstat_db_requested(Oid databaseid)
|
pgstat_db_requested(Oid databaseid)
|
||||||
@ -3471,11 +3340,8 @@ pgstat_db_requested(Oid databaseid)
|
|||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_inquiry() -
|
|
||||||
*
|
|
||||||
* Process stat inquiry requests.
|
* Process stat inquiry requests.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
|
pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
|
||||||
@ -3563,11 +3429,8 @@ pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
|
|||||||
msg->databaseid);
|
msg->databaseid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_tabstat() -
|
|
||||||
*
|
|
||||||
* Count what the backend has done.
|
* Count what the backend has done.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
|
pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
|
||||||
@ -3680,11 +3543,8 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_tabpurge() -
|
|
||||||
*
|
|
||||||
* Arrange for dead table removal.
|
* Arrange for dead table removal.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len)
|
pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len)
|
||||||
@ -3712,11 +3572,8 @@ pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_dropdb() -
|
|
||||||
*
|
|
||||||
* Arrange for dead database removal
|
* Arrange for dead database removal
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len)
|
pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len)
|
||||||
@ -3754,11 +3611,8 @@ pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_resetcounter() -
|
|
||||||
*
|
|
||||||
* Reset the statistics for the specified database.
|
* Reset the statistics for the specified database.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
|
pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
|
||||||
@ -3792,11 +3646,8 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
|
|||||||
reset_dbentry_counters(dbentry);
|
reset_dbentry_counters(dbentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_resetsharedcounter() -
|
|
||||||
*
|
|
||||||
* Reset some shared statistics of the cluster.
|
* Reset some shared statistics of the cluster.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_resetsharedcounter(PgStat_MsgResetsharedcounter *msg, int len)
|
pgstat_recv_resetsharedcounter(PgStat_MsgResetsharedcounter *msg, int len)
|
||||||
@ -3829,12 +3680,9 @@ pgstat_recv_resetsharedcounter(PgStat_MsgResetsharedcounter *msg, int len)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_resetsinglecounter() -
|
|
||||||
*
|
|
||||||
* Reset a statistics for a single object, which may be of current
|
* Reset a statistics for a single object, which may be of current
|
||||||
* database or shared across all databases in the cluster.
|
* database or shared across all databases in the cluster.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_resetsinglecounter(PgStat_MsgResetsinglecounter *msg, int len)
|
pgstat_recv_resetsinglecounter(PgStat_MsgResetsinglecounter *msg, int len)
|
||||||
@ -3861,11 +3709,8 @@ pgstat_recv_resetsinglecounter(PgStat_MsgResetsinglecounter *msg, int len)
|
|||||||
HASH_REMOVE, NULL);
|
HASH_REMOVE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_resetslrucounter() -
|
|
||||||
*
|
|
||||||
* Reset some SLRU statistics of the cluster.
|
* Reset some SLRU statistics of the cluster.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_resetslrucounter(PgStat_MsgResetslrucounter *msg, int len)
|
pgstat_recv_resetslrucounter(PgStat_MsgResetslrucounter *msg, int len)
|
||||||
@ -3884,11 +3729,8 @@ pgstat_recv_resetslrucounter(PgStat_MsgResetslrucounter *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_resetreplslotcounter() -
|
|
||||||
*
|
|
||||||
* Reset some replication slot statistics of the cluster.
|
* Reset some replication slot statistics of the cluster.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_resetreplslotcounter(PgStat_MsgResetreplslotcounter *msg,
|
pgstat_recv_resetreplslotcounter(PgStat_MsgResetreplslotcounter *msg,
|
||||||
@ -3929,11 +3771,8 @@ pgstat_recv_resetreplslotcounter(PgStat_MsgResetreplslotcounter *msg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_resetsubcounter() -
|
|
||||||
*
|
|
||||||
* Reset some subscription statistics of the cluster.
|
* Reset some subscription statistics of the cluster.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_resetsubcounter(PgStat_MsgResetsubcounter *msg, int len)
|
pgstat_recv_resetsubcounter(PgStat_MsgResetsubcounter *msg, int len)
|
||||||
@ -3974,11 +3813,8 @@ pgstat_recv_resetsubcounter(PgStat_MsgResetsubcounter *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_autovac() -
|
|
||||||
*
|
|
||||||
* Process an autovacuum signaling message.
|
* Process an autovacuum signaling message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_autovac(PgStat_MsgAutovacStart *msg, int len)
|
pgstat_recv_autovac(PgStat_MsgAutovacStart *msg, int len)
|
||||||
@ -3993,11 +3829,8 @@ pgstat_recv_autovac(PgStat_MsgAutovacStart *msg, int len)
|
|||||||
dbentry->last_autovac_time = msg->m_start_time;
|
dbentry->last_autovac_time = msg->m_start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_vacuum() -
|
|
||||||
*
|
|
||||||
* Process a VACUUM message.
|
* Process a VACUUM message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len)
|
pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len)
|
||||||
@ -4039,11 +3872,8 @@ pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_analyze() -
|
|
||||||
*
|
|
||||||
* Process an ANALYZE message.
|
* Process an ANALYZE message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len)
|
pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len)
|
||||||
@ -4081,11 +3911,8 @@ pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_archiver() -
|
|
||||||
*
|
|
||||||
* Process a ARCHIVER message.
|
* Process a ARCHIVER message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_archiver(PgStat_MsgArchiver *msg, int len)
|
pgstat_recv_archiver(PgStat_MsgArchiver *msg, int len)
|
||||||
@ -4108,11 +3935,8 @@ pgstat_recv_archiver(PgStat_MsgArchiver *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_bgwriter() -
|
|
||||||
*
|
|
||||||
* Process a BGWRITER message.
|
* Process a BGWRITER message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len)
|
pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len)
|
||||||
@ -4122,11 +3946,8 @@ pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len)
|
|||||||
globalStats.bgwriter.buf_alloc += msg->m_buf_alloc;
|
globalStats.bgwriter.buf_alloc += msg->m_buf_alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_checkpointer() -
|
|
||||||
*
|
|
||||||
* Process a CHECKPOINTER message.
|
* Process a CHECKPOINTER message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_checkpointer(PgStat_MsgCheckpointer *msg, int len)
|
pgstat_recv_checkpointer(PgStat_MsgCheckpointer *msg, int len)
|
||||||
@ -4140,11 +3961,8 @@ pgstat_recv_checkpointer(PgStat_MsgCheckpointer *msg, int len)
|
|||||||
globalStats.checkpointer.buf_fsync_backend += msg->m_buf_fsync_backend;
|
globalStats.checkpointer.buf_fsync_backend += msg->m_buf_fsync_backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_wal() -
|
|
||||||
*
|
|
||||||
* Process a WAL message.
|
* Process a WAL message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_wal(PgStat_MsgWal *msg, int len)
|
pgstat_recv_wal(PgStat_MsgWal *msg, int len)
|
||||||
@ -4159,11 +3977,8 @@ pgstat_recv_wal(PgStat_MsgWal *msg, int len)
|
|||||||
walStats.wal_sync_time += msg->m_wal_sync_time;
|
walStats.wal_sync_time += msg->m_wal_sync_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_slru() -
|
|
||||||
*
|
|
||||||
* Process a SLRU message.
|
* Process a SLRU message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_slru(PgStat_MsgSLRU *msg, int len)
|
pgstat_recv_slru(PgStat_MsgSLRU *msg, int len)
|
||||||
@ -4177,11 +3992,8 @@ pgstat_recv_slru(PgStat_MsgSLRU *msg, int len)
|
|||||||
slruStats[msg->m_index].truncate += msg->m_truncate;
|
slruStats[msg->m_index].truncate += msg->m_truncate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_recoveryconflict() -
|
|
||||||
*
|
|
||||||
* Process a RECOVERYCONFLICT message.
|
* Process a RECOVERYCONFLICT message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_recoveryconflict(PgStat_MsgRecoveryConflict *msg, int len)
|
pgstat_recv_recoveryconflict(PgStat_MsgRecoveryConflict *msg, int len)
|
||||||
@ -4217,11 +4029,8 @@ pgstat_recv_recoveryconflict(PgStat_MsgRecoveryConflict *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_deadlock() -
|
|
||||||
*
|
|
||||||
* Process a DEADLOCK message.
|
* Process a DEADLOCK message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_deadlock(PgStat_MsgDeadlock *msg, int len)
|
pgstat_recv_deadlock(PgStat_MsgDeadlock *msg, int len)
|
||||||
@ -4233,11 +4042,8 @@ pgstat_recv_deadlock(PgStat_MsgDeadlock *msg, int len)
|
|||||||
dbentry->n_deadlocks++;
|
dbentry->n_deadlocks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_checksum_failure() -
|
|
||||||
*
|
|
||||||
* Process a CHECKSUMFAILURE message.
|
* Process a CHECKSUMFAILURE message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_checksum_failure(PgStat_MsgChecksumFailure *msg, int len)
|
pgstat_recv_checksum_failure(PgStat_MsgChecksumFailure *msg, int len)
|
||||||
@ -4250,11 +4056,8 @@ pgstat_recv_checksum_failure(PgStat_MsgChecksumFailure *msg, int len)
|
|||||||
dbentry->last_checksum_failure = msg->m_failure_time;
|
dbentry->last_checksum_failure = msg->m_failure_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_replslot() -
|
|
||||||
*
|
|
||||||
* Process a REPLSLOT message.
|
* Process a REPLSLOT message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_replslot(PgStat_MsgReplSlot *msg, int len)
|
pgstat_recv_replslot(PgStat_MsgReplSlot *msg, int len)
|
||||||
@ -4301,11 +4104,8 @@ pgstat_recv_replslot(PgStat_MsgReplSlot *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_connect() -
|
|
||||||
*
|
|
||||||
* Process a CONNECT message.
|
* Process a CONNECT message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_connect(PgStat_MsgConnect *msg, int len)
|
pgstat_recv_connect(PgStat_MsgConnect *msg, int len)
|
||||||
@ -4316,11 +4116,8 @@ pgstat_recv_connect(PgStat_MsgConnect *msg, int len)
|
|||||||
dbentry->n_sessions++;
|
dbentry->n_sessions++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_disconnect() -
|
|
||||||
*
|
|
||||||
* Process a DISCONNECT message.
|
* Process a DISCONNECT message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_disconnect(PgStat_MsgDisconnect *msg, int len)
|
pgstat_recv_disconnect(PgStat_MsgDisconnect *msg, int len)
|
||||||
@ -4347,11 +4144,8 @@ pgstat_recv_disconnect(PgStat_MsgDisconnect *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_tempfile() -
|
|
||||||
*
|
|
||||||
* Process a TEMPFILE message.
|
* Process a TEMPFILE message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_tempfile(PgStat_MsgTempFile *msg, int len)
|
pgstat_recv_tempfile(PgStat_MsgTempFile *msg, int len)
|
||||||
@ -4364,11 +4158,8 @@ pgstat_recv_tempfile(PgStat_MsgTempFile *msg, int len)
|
|||||||
dbentry->n_temp_files += 1;
|
dbentry->n_temp_files += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_funcstat() -
|
|
||||||
*
|
|
||||||
* Count what the backend has done.
|
* Count what the backend has done.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len)
|
pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len)
|
||||||
@ -4412,11 +4203,8 @@ pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_funcpurge() -
|
|
||||||
*
|
|
||||||
* Arrange for dead function removal.
|
* Arrange for dead function removal.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_funcpurge(PgStat_MsgFuncpurge *msg, int len)
|
pgstat_recv_funcpurge(PgStat_MsgFuncpurge *msg, int len)
|
||||||
@ -4444,11 +4232,8 @@ pgstat_recv_funcpurge(PgStat_MsgFuncpurge *msg, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_subscription_drop() -
|
|
||||||
*
|
|
||||||
* Process a SUBSCRIPTIONDROP message.
|
* Process a SUBSCRIPTIONDROP message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_subscription_drop(PgStat_MsgSubscriptionDrop *msg, int len)
|
pgstat_recv_subscription_drop(PgStat_MsgSubscriptionDrop *msg, int len)
|
||||||
@ -4462,11 +4247,8 @@ pgstat_recv_subscription_drop(PgStat_MsgSubscriptionDrop *msg, int len)
|
|||||||
HASH_REMOVE, NULL);
|
HASH_REMOVE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_recv_subscription_error() -
|
|
||||||
*
|
|
||||||
* Process a SUBSCRIPTIONERROR message.
|
* Process a SUBSCRIPTIONERROR message.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_recv_subscription_error(PgStat_MsgSubscriptionError *msg, int len)
|
pgstat_recv_subscription_error(PgStat_MsgSubscriptionError *msg, int len)
|
||||||
|
@ -21,12 +21,9 @@
|
|||||||
#include "utils/timestamp.h"
|
#include "utils/timestamp.h"
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_send_archiver() -
|
|
||||||
*
|
|
||||||
* Tell the collector about the WAL file that we successfully
|
* Tell the collector about the WAL file that we successfully
|
||||||
* archived or failed to archive.
|
* archived or failed to archive.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_send_archiver(const char *xlog, bool failed)
|
pgstat_send_archiver(const char *xlog, bool failed)
|
||||||
|
@ -28,11 +28,8 @@
|
|||||||
PgStat_MsgBgWriter PendingBgWriterStats;
|
PgStat_MsgBgWriter PendingBgWriterStats;
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_send_bgwriter() -
|
|
||||||
*
|
|
||||||
* Send bgwriter statistics to the collector
|
* Send bgwriter statistics to the collector
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_send_bgwriter(void)
|
pgstat_send_bgwriter(void)
|
||||||
|
@ -28,11 +28,8 @@
|
|||||||
PgStat_MsgCheckpointer PendingCheckpointerStats;
|
PgStat_MsgCheckpointer PendingCheckpointerStats;
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_send_checkpointer() -
|
|
||||||
*
|
|
||||||
* Send checkpointer statistics to the collector
|
* Send checkpointer statistics to the collector
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_send_checkpointer(void)
|
pgstat_send_checkpointer(void)
|
||||||
|
@ -36,13 +36,10 @@ SessionEndType pgStatSessionEndCause = DISCONNECT_NORMAL;
|
|||||||
static PgStat_Counter pgLastSessionReportTime = 0;
|
static PgStat_Counter pgLastSessionReportTime = 0;
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_drop_database() -
|
|
||||||
*
|
|
||||||
* Tell the collector that we just dropped a database.
|
* Tell the collector that we just dropped a database.
|
||||||
* (If the message gets lost, we will still clean the dead DB eventually
|
* (If the message gets lost, we will still clean the dead DB eventually
|
||||||
* via future invocations of pgstat_vacuum_stat().)
|
* via future invocations of pgstat_vacuum_stat().)
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_drop_database(Oid databaseid)
|
pgstat_drop_database(Oid databaseid)
|
||||||
@ -57,11 +54,8 @@ pgstat_drop_database(Oid databaseid)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_recovery_conflict() -
|
|
||||||
*
|
|
||||||
* Tell the collector about a Hot Standby recovery conflict.
|
* Tell the collector about a Hot Standby recovery conflict.
|
||||||
* --------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_recovery_conflict(int reason)
|
pgstat_report_recovery_conflict(int reason)
|
||||||
@ -77,11 +71,8 @@ pgstat_report_recovery_conflict(int reason)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_deadlock() -
|
|
||||||
*
|
|
||||||
* Tell the collector about a deadlock detected.
|
* Tell the collector about a deadlock detected.
|
||||||
* --------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_deadlock(void)
|
pgstat_report_deadlock(void)
|
||||||
@ -96,11 +87,8 @@ pgstat_report_deadlock(void)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_checksum_failures_in_db() -
|
|
||||||
*
|
|
||||||
* Tell the collector about one or more checksum failures.
|
* Tell the collector about 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)
|
||||||
@ -118,11 +106,8 @@ pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_checksum_failure() -
|
|
||||||
*
|
|
||||||
* Tell the collector about a checksum failure.
|
* Tell the collector about a checksum failure.
|
||||||
* --------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_checksum_failure(void)
|
pgstat_report_checksum_failure(void)
|
||||||
@ -130,11 +115,8 @@ pgstat_report_checksum_failure(void)
|
|||||||
pgstat_report_checksum_failures_in_db(MyDatabaseId, 1);
|
pgstat_report_checksum_failures_in_db(MyDatabaseId, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_tempfile() -
|
|
||||||
*
|
|
||||||
* Tell the collector about a temporary file.
|
* Tell the collector about a temporary file.
|
||||||
* --------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_tempfile(size_t filesize)
|
pgstat_report_tempfile(size_t filesize)
|
||||||
@ -150,11 +132,8 @@ pgstat_report_tempfile(size_t filesize)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_connect() -
|
|
||||||
*
|
|
||||||
* Tell the collector about a new connection.
|
* Tell the collector about a new connection.
|
||||||
* --------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_connect(Oid dboid)
|
pgstat_report_connect(Oid dboid)
|
||||||
@ -171,11 +150,8 @@ pgstat_report_connect(Oid dboid)
|
|||||||
pgstat_send(&msg, sizeof(PgStat_MsgConnect));
|
pgstat_send(&msg, sizeof(PgStat_MsgConnect));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_disconnect() -
|
|
||||||
*
|
|
||||||
* Tell the collector about a disconnect.
|
* Tell the collector about a disconnect.
|
||||||
* --------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_disconnect(Oid dboid)
|
pgstat_report_disconnect(Oid dboid)
|
||||||
@ -262,15 +238,12 @@ pgstat_update_dbstats(PgStat_MsgTabstat *tsmsg, TimestampTz now)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_should_report_connstats() -
|
|
||||||
*
|
|
||||||
* We report session statistics only for normal backend processes. Parallel
|
* We report session statistics only for normal backend processes. Parallel
|
||||||
* workers run in parallel, so they don't contribute to session times, even
|
* workers run in parallel, so they don't contribute to session times, even
|
||||||
* though they use CPU time. Walsender processes could be considered here,
|
* though they use CPU time. Walsender processes could be considered here,
|
||||||
* but they have different session characteristics from normal backends (for
|
* but they have different session characteristics from normal backends (for
|
||||||
* example, they are always "active"), so they would skew session statistics.
|
* example, they are always "active"), so they would skew session statistics.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
pgstat_should_report_connstat(void)
|
pgstat_should_report_connstat(void)
|
||||||
|
@ -206,8 +206,7 @@ pgstat_send_funcstats(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find_funcstat_entry - find any existing PgStat_BackendFunctionEntry entry
|
* find any existing PgStat_BackendFunctionEntry entry for specified function
|
||||||
* for specified function
|
|
||||||
*
|
*
|
||||||
* If no entry, return NULL, don't create a new one
|
* If no entry, return NULL, don't create a new one
|
||||||
*/
|
*/
|
||||||
|
@ -95,9 +95,7 @@ bool have_relation_stats;
|
|||||||
static HTAB *pgStatTabHash = NULL;
|
static HTAB *pgStatTabHash = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_relation_init() -
|
|
||||||
*
|
|
||||||
* Initialize a relcache entry to count access statistics.
|
* Initialize a relcache entry to count access statistics.
|
||||||
* Called whenever a relation is opened.
|
* Called whenever a relation is opened.
|
||||||
*
|
*
|
||||||
@ -105,7 +103,6 @@ static HTAB *pgStatTabHash = NULL;
|
|||||||
* relcache.c when the relcache entry is made; thereafter it is long-lived
|
* relcache.c when the relcache entry is made; thereafter it is long-lived
|
||||||
* data. We can avoid repeated searches of the TabStatus arrays when the
|
* data. We can avoid repeated searches of the TabStatus arrays when the
|
||||||
* same relation is touched repeatedly within a transaction.
|
* same relation is touched repeatedly within a transaction.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_relation_init(Relation rel)
|
pgstat_relation_init(Relation rel)
|
||||||
@ -141,16 +138,13 @@ pgstat_relation_init(Relation rel)
|
|||||||
rel->pgstat_info = get_tabstat_entry(rel_id, rel->rd_rel->relisshared);
|
rel->pgstat_info = get_tabstat_entry(rel_id, rel->rd_rel->relisshared);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_drop_relation() -
|
|
||||||
*
|
|
||||||
* Tell the collector that we just dropped a relation.
|
* Tell the collector that we just dropped a relation.
|
||||||
* (If the message gets lost, we will still clean the dead entry eventually
|
* (If the message gets lost, we will still clean the dead entry eventually
|
||||||
* via future invocations of pgstat_vacuum_stat().)
|
* via future invocations of pgstat_vacuum_stat().)
|
||||||
*
|
*
|
||||||
* Currently not used for lack of any good place to call it; we rely
|
* Currently not used for lack of any good place to call it; we rely
|
||||||
* entirely on pgstat_vacuum_stat() to clean out stats for dead rels.
|
* entirely on pgstat_vacuum_stat() to clean out stats for dead rels.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
#ifdef NOT_USED
|
#ifdef NOT_USED
|
||||||
void
|
void
|
||||||
@ -173,13 +167,10 @@ pgstat_drop_relation(Oid relid)
|
|||||||
}
|
}
|
||||||
#endif /* NOT_USED */
|
#endif /* NOT_USED */
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_report_autovac() -
|
|
||||||
*
|
|
||||||
* Called from autovacuum.c to report startup of an autovacuum process.
|
* Called from autovacuum.c to report startup of an autovacuum process.
|
||||||
* We are called before InitPostgres is done, so can't rely on MyDatabaseId;
|
* We are called before InitPostgres is done, so can't rely on MyDatabaseId;
|
||||||
* the db OID must be passed in, instead.
|
* the db OID must be passed in, instead.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_autovac(Oid dboid)
|
pgstat_report_autovac(Oid dboid)
|
||||||
@ -196,11 +187,8 @@ pgstat_report_autovac(Oid dboid)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------
|
/*
|
||||||
* pgstat_report_vacuum() -
|
|
||||||
*
|
|
||||||
* Tell the collector about the table we just vacuumed.
|
* Tell the collector about the table we just vacuumed.
|
||||||
* ---------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_vacuum(Oid tableoid, bool shared,
|
pgstat_report_vacuum(Oid tableoid, bool shared,
|
||||||
@ -221,14 +209,11 @@ pgstat_report_vacuum(Oid tableoid, bool shared,
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------
|
/*
|
||||||
* pgstat_report_analyze() -
|
|
||||||
*
|
|
||||||
* Tell the collector about the table we just analyzed.
|
* Tell the collector about the table we 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.
|
||||||
* --------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_analyze(Relation rel,
|
pgstat_report_analyze(Relation rel,
|
||||||
@ -281,7 +266,7 @@ pgstat_report_analyze(Relation rel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_count_heap_insert - count a tuple insertion of n tuples
|
* count a tuple insertion of n tuples
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
|
pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
|
||||||
@ -296,7 +281,7 @@ pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_count_heap_update - count a tuple update
|
* count a tuple update
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_count_heap_update(Relation rel, bool hot)
|
pgstat_count_heap_update(Relation rel, bool hot)
|
||||||
@ -315,7 +300,7 @@ pgstat_count_heap_update(Relation rel, bool hot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_count_heap_delete - count a tuple deletion
|
* count a tuple deletion
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_count_heap_delete(Relation rel)
|
pgstat_count_heap_delete(Relation rel)
|
||||||
@ -330,7 +315,7 @@ pgstat_count_heap_delete(Relation rel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_count_truncate - update tuple counters due to truncate
|
* update tuple counters due to truncate
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_count_truncate(Relation rel)
|
pgstat_count_truncate(Relation rel)
|
||||||
@ -348,7 +333,7 @@ pgstat_count_truncate(Relation rel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_update_heap_dead_tuples - update dead-tuples count
|
* update dead-tuples count
|
||||||
*
|
*
|
||||||
* The semantics of this are that we are reporting the nontransactional
|
* The semantics of this are that we are reporting the nontransactional
|
||||||
* recovery of "delta" dead tuples; so t_delta_dead_tuples decreases
|
* recovery of "delta" dead tuples; so t_delta_dead_tuples decreases
|
||||||
@ -367,7 +352,7 @@ pgstat_update_heap_dead_tuples(Relation rel, int delta)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find_tabstat_entry - find any existing PgStat_TableStatus entry for rel
|
* find any existing PgStat_TableStatus entry for rel
|
||||||
*
|
*
|
||||||
* If no entry, return NULL, don't create a new one
|
* If no entry, return NULL, don't create a new one
|
||||||
*
|
*
|
||||||
@ -772,7 +757,7 @@ pgstat_send_tabstat(PgStat_MsgTabstat *tsmsg, TimestampTz now)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_tabstat_entry - find or create a PgStat_TableStatus entry for rel
|
* find or create a PgStat_TableStatus entry for rel
|
||||||
*/
|
*/
|
||||||
static PgStat_TableStatus *
|
static PgStat_TableStatus *
|
||||||
get_tabstat_entry(Oid rel_id, bool isshared)
|
get_tabstat_entry(Oid rel_id, bool isshared)
|
||||||
@ -858,7 +843,7 @@ get_tabstat_entry(Oid rel_id, bool isshared)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add_tabstat_xact_level - add a new (sub)transaction state record
|
* add a new (sub)transaction state record
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
|
add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
|
||||||
@ -898,8 +883,6 @@ ensure_tabstat_xact_level(PgStat_TableStatus *pgstat_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_truncdrop_save_counters
|
|
||||||
*
|
|
||||||
* Whenever a table is truncated/dropped, we save its i/u/d counters so that
|
* Whenever a table is truncated/dropped, we save its i/u/d counters so that
|
||||||
* they can be cleared, and if the (sub)xact that executed the truncate/drop
|
* they can be cleared, and if the (sub)xact that executed the truncate/drop
|
||||||
* later aborts, the counters can be restored to the saved (pre-truncate/drop)
|
* later aborts, the counters can be restored to the saved (pre-truncate/drop)
|
||||||
@ -921,7 +904,7 @@ pgstat_truncdrop_save_counters(PgStat_TableXactStatus *trans, bool is_drop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_truncdrop_restore_counters - restore counters when a truncate aborts
|
* restore counters when a truncate aborts
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
pgstat_truncdrop_restore_counters(PgStat_TableXactStatus *trans)
|
pgstat_truncdrop_restore_counters(PgStat_TableXactStatus *trans)
|
||||||
|
@ -22,15 +22,12 @@
|
|||||||
#include "utils/pgstat_internal.h"
|
#include "utils/pgstat_internal.h"
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_replslot_counter() -
|
|
||||||
*
|
|
||||||
* Tell the statistics collector to reset a single replication slot
|
* Tell the statistics collector to reset a single replication slot
|
||||||
* counter, or all replication slots counters (when name is null).
|
* counter, or all replication slots 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.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_reset_replslot_counter(const char *name)
|
pgstat_reset_replslot_counter(const char *name)
|
||||||
@ -53,11 +50,8 @@ pgstat_reset_replslot_counter(const char *name)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_report_replslot() -
|
|
||||||
*
|
|
||||||
* Tell the collector about replication slot statistics.
|
* Tell the collector about replication slot statistics.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat)
|
pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat)
|
||||||
@ -82,11 +76,8 @@ pgstat_report_replslot(const PgStat_StatReplSlotEntry *repSlotStat)
|
|||||||
pgstat_send(&msg, sizeof(PgStat_MsgReplSlot));
|
pgstat_send(&msg, sizeof(PgStat_MsgReplSlot));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_report_replslot_create() -
|
|
||||||
*
|
|
||||||
* Tell the collector about creating the replication slot.
|
* Tell the collector about creating the replication slot.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_replslot_create(const char *slotname)
|
pgstat_report_replslot_create(const char *slotname)
|
||||||
@ -100,11 +91,8 @@ pgstat_report_replslot_create(const char *slotname)
|
|||||||
pgstat_send(&msg, sizeof(PgStat_MsgReplSlot));
|
pgstat_send(&msg, sizeof(PgStat_MsgReplSlot));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_report_replslot_drop() -
|
|
||||||
*
|
|
||||||
* Tell the collector about dropping the replication slot.
|
* Tell the collector about dropping the replication slot.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_replslot_drop(const char *slotname)
|
pgstat_report_replslot_drop(const char *slotname)
|
||||||
|
@ -32,15 +32,12 @@ static inline PgStat_MsgSLRU *slru_entry(int slru_idx);
|
|||||||
static PgStat_MsgSLRU SLRUStats[SLRU_NUM_ELEMENTS];
|
static PgStat_MsgSLRU SLRUStats[SLRU_NUM_ELEMENTS];
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_slru_counter() -
|
|
||||||
*
|
|
||||||
* Tell the statistics collector to reset a single SLRU counter, or all
|
* Tell the statistics collector to reset a single SLRU counter, or all
|
||||||
* SLRU counters (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.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_reset_slru_counter(const char *name)
|
pgstat_reset_slru_counter(const char *name)
|
||||||
@ -103,8 +100,6 @@ pgstat_count_slru_truncate(int slru_idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_slru_name
|
|
||||||
*
|
|
||||||
* Returns SLRU name for an index. The index may be above SLRU_NUM_ELEMENTS,
|
* Returns SLRU name for an index. The index may be above SLRU_NUM_ELEMENTS,
|
||||||
* in which case this returns NULL. This allows writing code that does not
|
* in which case this returns NULL. This allows writing code that does not
|
||||||
* know the number of entries in advance.
|
* know the number of entries in advance.
|
||||||
@ -119,8 +114,6 @@ pgstat_slru_name(int slru_idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pgstat_slru_index
|
|
||||||
*
|
|
||||||
* Determine index of entry for a SLRU with a given name. If there's no exact
|
* Determine index of entry for a SLRU with a given name. If there's no exact
|
||||||
* match, returns index of the last "other" entry used for SLRUs defined in
|
* match, returns index of the last "other" entry used for SLRUs defined in
|
||||||
* external projects.
|
* external projects.
|
||||||
@ -140,11 +133,8 @@ pgstat_slru_index(const char *name)
|
|||||||
return (SLRU_NUM_ELEMENTS - 1);
|
return (SLRU_NUM_ELEMENTS - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_send_slru() -
|
|
||||||
*
|
|
||||||
* Send SLRU statistics to the collector
|
* Send SLRU statistics to the collector
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_send_slru(void)
|
pgstat_send_slru(void)
|
||||||
@ -179,8 +169,6 @@ pgstat_send_slru(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* slru_entry
|
|
||||||
*
|
|
||||||
* Returns pointer to entry with counters for given SLRU (based on the name
|
* Returns pointer to entry with counters for given SLRU (based on the name
|
||||||
* stored in SlruCtl as lwlock tranche name).
|
* stored in SlruCtl as lwlock tranche name).
|
||||||
*/
|
*/
|
||||||
|
@ -20,15 +20,12 @@
|
|||||||
#include "utils/pgstat_internal.h"
|
#include "utils/pgstat_internal.h"
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_reset_subscription_counter() -
|
|
||||||
*
|
|
||||||
* Tell the statistics collector to reset a single subscription
|
* Tell the statistics collector to reset a single subscription
|
||||||
* counter, or all subscription counters (when subid is InvalidOid).
|
* counter, or all subscription counters (when subid 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.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_reset_subscription_counter(Oid subid)
|
pgstat_reset_subscription_counter(Oid subid)
|
||||||
@ -44,11 +41,8 @@ pgstat_reset_subscription_counter(Oid subid)
|
|||||||
pgstat_send(&msg, sizeof(msg));
|
pgstat_send(&msg, sizeof(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_report_subscription_error() -
|
|
||||||
*
|
|
||||||
* Tell the collector about the subscription error.
|
* Tell the collector about the subscription error.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_subscription_error(Oid subid, bool is_apply_error)
|
pgstat_report_subscription_error(Oid subid, bool is_apply_error)
|
||||||
@ -61,11 +55,8 @@ pgstat_report_subscription_error(Oid subid, bool is_apply_error)
|
|||||||
pgstat_send(&msg, sizeof(PgStat_MsgSubscriptionError));
|
pgstat_send(&msg, sizeof(PgStat_MsgSubscriptionError));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_report_subscription_drop() -
|
|
||||||
*
|
|
||||||
* Tell the collector about dropping the subscription.
|
* Tell the collector about dropping the subscription.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_report_subscription_drop(Oid subid)
|
pgstat_report_subscription_drop(Oid subid)
|
||||||
|
@ -38,14 +38,11 @@ PgStat_MsgWal WalStats;
|
|||||||
static WalUsage prevWalUsage;
|
static WalUsage prevWalUsage;
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/*
|
||||||
* pgstat_send_wal() -
|
|
||||||
*
|
|
||||||
* Send WAL statistics to the collector.
|
* Send WAL statistics to the collector.
|
||||||
*
|
*
|
||||||
* If 'force' is not set, WAL stats message is only sent if enough time has
|
* If 'force' is not set, WAL stats message is only sent if enough time has
|
||||||
* passed since last one was sent to reach PGSTAT_STAT_INTERVAL.
|
* passed since last one was sent to reach PGSTAT_STAT_INTERVAL.
|
||||||
* ----------
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pgstat_send_wal(bool force)
|
pgstat_send_wal(bool force)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user