mirror of
https://github.com/postgres/postgres.git
synced 2025-06-10 09:21:54 +03:00
Adjust some comments about structure properties in pg_stat.h
One comment of PgStat_TableCounts mentioned that its pending stats use memcmp() to check for the all-zero case if there is any activity. This is not true since 07e9e28b56, as pg_memory_is_all_zeros() is used. PgStat_FunctionCounts incorrectly documented that it relied on memcpy(). This has never been correct, and not relevant because function statistics do not have an all-zero check for pending stats. Checkpoint and bgwriter statistics have been always relying on memcmp() or pg_memory_is_all_zeros() (since 07e9e28b56 for the latter), and never mentioned the dependency on event counters for their all-zero checks. Let's document these properties, like the table statistics. Author: Bertrand Drouvot Discussion: https://postgr.es/m/Z1hNLvcPgVLPxCoc@ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
parent
bd10ec5297
commit
4766438aa3
@ -128,9 +128,6 @@ typedef int64 PgStat_Counter;
|
|||||||
/* ----------
|
/* ----------
|
||||||
* PgStat_FunctionCounts The actual per-function counts kept by a backend
|
* PgStat_FunctionCounts The actual per-function counts kept by a backend
|
||||||
*
|
*
|
||||||
* This struct should contain only actual event counters, because we memcmp
|
|
||||||
* it against zeroes to detect whether there are any pending stats.
|
|
||||||
*
|
|
||||||
* Note that the time counters are in instr_time format here. We convert to
|
* Note that the time counters are in instr_time format here. We convert to
|
||||||
* microseconds in PgStat_Counter format when flushing out pending statistics.
|
* microseconds in PgStat_Counter format when flushing out pending statistics.
|
||||||
* ----------
|
* ----------
|
||||||
@ -172,8 +169,10 @@ typedef struct PgStat_BackendSubEntry
|
|||||||
/* ----------
|
/* ----------
|
||||||
* PgStat_TableCounts The actual per-table counts kept by a backend
|
* PgStat_TableCounts The actual per-table counts kept by a backend
|
||||||
*
|
*
|
||||||
* This struct should contain only actual event counters, because we memcmp
|
* This struct should contain only actual event counters, because we make use
|
||||||
* it against zeroes to detect whether there are any stats updates to apply.
|
* of pg_memory_is_all_zeros() to detect whether there are any stats updates
|
||||||
|
* to apply.
|
||||||
|
*
|
||||||
* It is a component of PgStat_TableStatus (within-backend state).
|
* It is a component of PgStat_TableStatus (within-backend state).
|
||||||
*
|
*
|
||||||
* Note: for a table, tuples_returned is the number of tuples successfully
|
* Note: for a table, tuples_returned is the number of tuples successfully
|
||||||
@ -282,6 +281,14 @@ typedef struct PgStat_ArchiverStats
|
|||||||
TimestampTz stat_reset_timestamp;
|
TimestampTz stat_reset_timestamp;
|
||||||
} PgStat_ArchiverStats;
|
} PgStat_ArchiverStats;
|
||||||
|
|
||||||
|
/* ---------
|
||||||
|
* PgStat_BgWriterStats Background Writer statistics
|
||||||
|
*
|
||||||
|
* This struct should contain only actual event counters, because we make use
|
||||||
|
* of pg_memory_is_all_zeros() to detect whether there are any stats updates
|
||||||
|
* to apply.
|
||||||
|
* ---------
|
||||||
|
*/
|
||||||
typedef struct PgStat_BgWriterStats
|
typedef struct PgStat_BgWriterStats
|
||||||
{
|
{
|
||||||
PgStat_Counter buf_written_clean;
|
PgStat_Counter buf_written_clean;
|
||||||
@ -290,6 +297,14 @@ typedef struct PgStat_BgWriterStats
|
|||||||
TimestampTz stat_reset_timestamp;
|
TimestampTz stat_reset_timestamp;
|
||||||
} PgStat_BgWriterStats;
|
} PgStat_BgWriterStats;
|
||||||
|
|
||||||
|
/* --------
|
||||||
|
* PgStat_CheckpointerStats Checkpoint statistics
|
||||||
|
*
|
||||||
|
* This struct should contain only actual event counters, because we make use
|
||||||
|
* of pg_memory_is_all_zeros() to detect whether there are any stats updates to
|
||||||
|
* apply.
|
||||||
|
* ---------
|
||||||
|
*/
|
||||||
typedef struct PgStat_CheckpointerStats
|
typedef struct PgStat_CheckpointerStats
|
||||||
{
|
{
|
||||||
PgStat_Counter num_timed;
|
PgStat_Counter num_timed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user