Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4766438

Browse files
committed
Adjust some comments about structure properties in pg_stat.h
One comment of PgStat_TableCounts mentioned that its pending stats usememcmp() to check for the all-zero case if there is any activity. Thisis not true since07e9e28, 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 functionstatistics 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() (since07e9e28 for the latter), and nevermentioned the dependency on event counters for their all-zero checks.Let's document these properties, like the table statistics.Author: Bertrand DrouvotDiscussion:https://postgr.es/m/Z1hNLvcPgVLPxCoc@ip-10-97-1-34.eu-west-3.compute.internal
1 parentbd10ec5 commit4766438

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

‎src/include/pgstat.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ typedef int64 PgStat_Counter;
128128
/* ----------
129129
* PgStat_FunctionCountsThe actual per-function counts kept by a backend
130130
*
131-
* This struct should contain only actual event counters, because we memcmp
132-
* it against zeroes to detect whether there are any pending stats.
133-
*
134131
* Note that the time counters are in instr_time format here. We convert to
135132
* microseconds in PgStat_Counter format when flushing out pending statistics.
136133
* ----------
@@ -172,8 +169,10 @@ typedef struct PgStat_BackendSubEntry
172169
/* ----------
173170
* PgStat_TableCountsThe actual per-table counts kept by a backend
174171
*
175-
* This struct should contain only actual event counters, because we memcmp
176-
* it against zeroes to detect whether there are any stats updates to apply.
172+
* This struct should contain only actual event counters, because we make use
173+
* of pg_memory_is_all_zeros() to detect whether there are any stats updates
174+
* to apply.
175+
*
177176
* It is a component of PgStat_TableStatus (within-backend state).
178177
*
179178
* Note: for a table, tuples_returned is the number of tuples successfully
@@ -282,6 +281,14 @@ typedef struct PgStat_ArchiverStats
282281
TimestampTzstat_reset_timestamp;
283282
}PgStat_ArchiverStats;
284283

284+
/* ---------
285+
* PgStat_BgWriterStatsBackground Writer statistics
286+
*
287+
* This struct should contain only actual event counters, because we make use
288+
* of pg_memory_is_all_zeros() to detect whether there are any stats updates
289+
* to apply.
290+
* ---------
291+
*/
285292
typedefstructPgStat_BgWriterStats
286293
{
287294
PgStat_Counterbuf_written_clean;
@@ -290,6 +297,14 @@ typedef struct PgStat_BgWriterStats
290297
TimestampTzstat_reset_timestamp;
291298
}PgStat_BgWriterStats;
292299

300+
/* --------
301+
* PgStat_CheckpointerStatsCheckpoint statistics
302+
*
303+
* This struct should contain only actual event counters, because we make use
304+
* of pg_memory_is_all_zeros() to detect whether there are any stats updates to
305+
* apply.
306+
* ---------
307+
*/
293308
typedefstructPgStat_CheckpointerStats
294309
{
295310
PgStat_Counternum_timed;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp