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

Commit74604a3

Browse files
committed
Remove buffers_backend and buffers_backend_fsync from pg_stat_checkpointer
Two attributes related to checkpointer statistics are removed in thiscommit:- buffers_backend, that counts the number of buffers written directly bya backend.- buffers_backend_fsync, that counts the number of times a backend hadto do fsync() by its own.These are actually not checkpointer properties but backend properties.Also, pg_stat_io provides a more accurate and equivalent report of thesenumbers, by tracking all the I/O stats related to backends, includingwrites and fsyncs, so storing them in pg_stat_checkpointer wasredundant.Thanks also to Robert Haas and Amit Kapila for their input.Bump catalog version.Author: Bharath RupireddyReviewed-by: Bertrand Drouvot, Andres FreundDiscussion:https://postgr.es/m/20230210004604.mcszbscsqs3bc5nx@awork3.anarazel.de
1 parent0c882a2 commit74604a3

File tree

9 files changed

+3
-82
lines changed

9 files changed

+3
-82
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,26 +2953,6 @@ description | Waiting for a newly initialized WAL file to reach durable storage
29532953
</para></entry>
29542954
</row>
29552955

2956-
<row>
2957-
<entry role="catalog_table_entry"><para role="column_definition">
2958-
<structfield>buffers_backend</structfield> <type>bigint</type>
2959-
</para>
2960-
<para>
2961-
Number of buffers written directly by a backend
2962-
</para></entry>
2963-
</row>
2964-
2965-
<row>
2966-
<entry role="catalog_table_entry"><para role="column_definition">
2967-
<structfield>buffers_backend_fsync</structfield> <type>bigint</type>
2968-
</para>
2969-
<para>
2970-
Number of times a backend had to execute its own
2971-
<function>fsync</function> call (normally the background writer handles those
2972-
even when the backend does its own write)
2973-
</para></entry>
2974-
</row>
2975-
29762956
<row>
29772957
<entry role="catalog_table_entry"><para role="column_definition">
29782958
<structfield>buffers_alloc</structfield> <type>bigint</type>

‎src/backend/catalog/system_views.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,6 @@ CREATE VIEW pg_stat_bgwriter AS
11181118
pg_stat_get_bgwriter_buf_written_checkpoints()AS buffers_checkpoint,
11191119
pg_stat_get_bgwriter_buf_written_clean()AS buffers_clean,
11201120
pg_stat_get_bgwriter_maxwritten_clean()AS maxwritten_clean,
1121-
pg_stat_get_buf_written_backend()AS buffers_backend,
1122-
pg_stat_get_buf_fsync_backend()AS buffers_backend_fsync,
11231121
pg_stat_get_buf_alloc()AS buffers_alloc,
11241122
pg_stat_get_bgwriter_stat_reset_time()AS stats_reset;
11251123

‎src/backend/postmaster/checkpointer.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,11 @@
9191
* requesting backends since the last checkpoint start. The flags are
9292
* chosen so that OR'ing is the correct way to combine multiple requests.
9393
*
94-
* num_backend_writes is used to count the number of buffer writes performed
95-
* by user backend processes. This counter should be wide enough that it
96-
* can't overflow during a single processing cycle. num_backend_fsync
97-
* counts the subset of those writes that also had to do their own fsync,
98-
* because the checkpointer failed to absorb their request.
99-
*
10094
* The requests array holds fsync requests sent by backends and not yet
10195
* absorbed by the checkpointer.
10296
*
103-
* Unlike the checkpoint fields,num_backend_writes, num_backend_fsync, and
104-
*the requests fields are protected byCheckpointerCommLock.
97+
* Unlike the checkpoint fields,requests related fields are protected by
98+
* CheckpointerCommLock.
10599
*----------
106100
*/
107101
typedefstruct
@@ -125,9 +119,6 @@ typedef struct
125119
ConditionVariablestart_cv;/* signaled when ckpt_started advances */
126120
ConditionVariabledone_cv;/* signaled when ckpt_done advances */
127121

128-
uint32num_backend_writes;/* counts user backend buffer writes */
129-
uint32num_backend_fsync;/* counts user backend fsync calls */
130-
131122
intnum_requests;/* current # of requests */
132123
intmax_requests;/* allocated array size */
133124
CheckpointerRequestrequests[FLEXIBLE_ARRAY_MEMBER];
@@ -1095,10 +1086,6 @@ ForwardSyncRequest(const FileTag *ftag, SyncRequestType type)
10951086

10961087
LWLockAcquire(CheckpointerCommLock,LW_EXCLUSIVE);
10971088

1098-
/* Count all backend writes regardless of if they fit in the queue */
1099-
if (!AmBackgroundWriterProcess())
1100-
CheckpointerShmem->num_backend_writes++;
1101-
11021089
/*
11031090
* If the checkpointer isn't running or the request queue is full, the
11041091
* backend will have to perform its own fsync request. But before forcing
@@ -1108,12 +1095,6 @@ ForwardSyncRequest(const FileTag *ftag, SyncRequestType type)
11081095
(CheckpointerShmem->num_requests >=CheckpointerShmem->max_requests&&
11091096
!CompactCheckpointerRequestQueue()))
11101097
{
1111-
/*
1112-
* Count the subset of writes where backends have to do their own
1113-
* fsync
1114-
*/
1115-
if (!AmBackgroundWriterProcess())
1116-
CheckpointerShmem->num_backend_fsync++;
11171098
LWLockRelease(CheckpointerCommLock);
11181099
return false;
11191100
}
@@ -1270,15 +1251,6 @@ AbsorbSyncRequests(void)
12701251

12711252
LWLockAcquire(CheckpointerCommLock,LW_EXCLUSIVE);
12721253

1273-
/* Transfer stats counts into pending pgstats message */
1274-
PendingCheckpointerStats.buf_written_backend
1275-
+=CheckpointerShmem->num_backend_writes;
1276-
PendingCheckpointerStats.buf_fsync_backend
1277-
+=CheckpointerShmem->num_backend_fsync;
1278-
1279-
CheckpointerShmem->num_backend_writes=0;
1280-
CheckpointerShmem->num_backend_fsync=0;
1281-
12821254
/*
12831255
* We try to avoid holding the lock for a long time by copying the request
12841256
* array, and processing the requests after releasing the lock.

‎src/backend/utils/activity/pgstat_checkpointer.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ pgstat_report_checkpointer(void)
5252
CHECKPOINTER_ACC(checkpoint_write_time);
5353
CHECKPOINTER_ACC(checkpoint_sync_time);
5454
CHECKPOINTER_ACC(buf_written_checkpoints);
55-
CHECKPOINTER_ACC(buf_written_backend);
56-
CHECKPOINTER_ACC(buf_fsync_backend);
5755
#undef CHECKPOINTER_ACC
5856

5957
pgstat_end_changecount_write(&stats_shmem->changecount);
@@ -120,7 +118,5 @@ pgstat_checkpointer_snapshot_cb(void)
120118
CHECKPOINTER_COMP(checkpoint_write_time);
121119
CHECKPOINTER_COMP(checkpoint_sync_time);
122120
CHECKPOINTER_COMP(buf_written_checkpoints);
123-
CHECKPOINTER_COMP(buf_written_backend);
124-
CHECKPOINTER_COMP(buf_fsync_backend);
125121
#undef CHECKPOINTER_COMP
126122
}

‎src/backend/utils/adt/pgstatfuncs.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,18 +1233,6 @@ pg_stat_get_bgwriter_stat_reset_time(PG_FUNCTION_ARGS)
12331233
PG_RETURN_TIMESTAMPTZ(pgstat_fetch_stat_bgwriter()->stat_reset_timestamp);
12341234
}
12351235

1236-
Datum
1237-
pg_stat_get_buf_written_backend(PG_FUNCTION_ARGS)
1238-
{
1239-
PG_RETURN_INT64(pgstat_fetch_stat_checkpointer()->buf_written_backend);
1240-
}
1241-
1242-
Datum
1243-
pg_stat_get_buf_fsync_backend(PG_FUNCTION_ARGS)
1244-
{
1245-
PG_RETURN_INT64(pgstat_fetch_stat_checkpointer()->buf_fsync_backend);
1246-
}
1247-
12481236
Datum
12491237
pg_stat_get_buf_alloc(PG_FUNCTION_ARGS)
12501238
{

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/*yyyymmddN */
60-
#defineCATALOG_VERSION_NO202310261
60+
#defineCATALOG_VERSION_NO202310271
6161

6262
#endif

‎src/include/catalog/pg_proc.dat

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5738,15 +5738,6 @@
57385738
proname => 'pg_stat_get_checkpoint_sync_time', provolatile => 's',
57395739
proparallel => 'r', prorettype => 'float8', proargtypes => '',
57405740
prosrc => 'pg_stat_get_checkpoint_sync_time' },
5741-
{ oid => '2775', descr => 'statistics: number of buffers written by backends',
5742-
proname => 'pg_stat_get_buf_written_backend', provolatile => 's',
5743-
proparallel => 'r', prorettype => 'int8', proargtypes => '',
5744-
prosrc => 'pg_stat_get_buf_written_backend' },
5745-
{ oid => '3063',
5746-
descr => 'statistics: number of backend buffer writes that did their own fsync',
5747-
proname => 'pg_stat_get_buf_fsync_backend', provolatile => 's',
5748-
proparallel => 'r', prorettype => 'int8', proargtypes => '',
5749-
prosrc => 'pg_stat_get_buf_fsync_backend' },
57505741
{ oid => '2859', descr => 'statistics: number of buffer allocations',
57515742
proname => 'pg_stat_get_buf_alloc', provolatile => 's', proparallel => 'r',
57525743
prorettype => 'int8', proargtypes => '', prosrc => 'pg_stat_get_buf_alloc' },

‎src/include/pgstat.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,6 @@ typedef struct PgStat_CheckpointerStats
265265
PgStat_Countercheckpoint_write_time;/* times in milliseconds */
266266
PgStat_Countercheckpoint_sync_time;
267267
PgStat_Counterbuf_written_checkpoints;
268-
PgStat_Counterbuf_written_backend;
269-
PgStat_Counterbuf_fsync_backend;
270268
}PgStat_CheckpointerStats;
271269

272270

‎src/test/regress/expected/rules.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,8 +1823,6 @@ pg_stat_bgwriter| SELECT pg_stat_get_bgwriter_timed_checkpoints() AS checkpoints
18231823
pg_stat_get_bgwriter_buf_written_checkpoints() AS buffers_checkpoint,
18241824
pg_stat_get_bgwriter_buf_written_clean() AS buffers_clean,
18251825
pg_stat_get_bgwriter_maxwritten_clean() AS maxwritten_clean,
1826-
pg_stat_get_buf_written_backend() AS buffers_backend,
1827-
pg_stat_get_buf_fsync_backend() AS buffers_backend_fsync,
18281826
pg_stat_get_buf_alloc() AS buffers_alloc,
18291827
pg_stat_get_bgwriter_stat_reset_time() AS stats_reset;
18301828
pg_stat_database| SELECT oid AS datid,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp