mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Restrict pg_stat_io entries for data checksum processes
The data checksums launcher and workers were exposed in pg_stat_io with the same broad set of object/context combinations as general background workers. However, several of those entries can never accumulate I/O statistics for these processes, such as bulkwrite, relation init, temporary relation, and launcher vacuum entries. Teach pgstat_tracks_io_object() and pgstat_tracks_io_op() about the actual I/O performed by the data checksum processes. Keep the entries needed for catalog scans, including bulkread catalog scans, worker relation processing with a vacuum access strategy, and WAL writes and initialization, while excluding WAL reads and other object/context combinations that can never be used. Author: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/CAHGQGwHz_-nt+YkHDMRZNBZrnoHro8cMOgSwuXEmSYT6vxgQ=w@mail.gmail.com Backpatch-through: 19
This commit is contained in:
@@ -464,6 +464,37 @@ pgstat_tracks_io_object(BackendType bktype, IOObject io_object,
|
||||
io_context == IOCONTEXT_BULKWRITE)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* The data checksums launcher scans catalogs and emits WAL records for
|
||||
* checksum state changes. Catalog scans can use a bulkread strategy.
|
||||
*/
|
||||
if (bktype == B_DATACHECKSUMSWORKER_LAUNCHER)
|
||||
{
|
||||
if (io_object == IOOBJECT_WAL ||
|
||||
(io_object == IOOBJECT_RELATION &&
|
||||
(io_context == IOCONTEXT_BULKREAD ||
|
||||
io_context == IOCONTEXT_NORMAL)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* The worker also scans catalogs, then processes relations using a vacuum
|
||||
* access strategy. Catalog scans can use a bulkread strategy.
|
||||
*/
|
||||
if (bktype == B_DATACHECKSUMSWORKER_WORKER)
|
||||
{
|
||||
if (io_object == IOOBJECT_WAL ||
|
||||
(io_object == IOOBJECT_RELATION &&
|
||||
(io_context == IOCONTEXT_BULKREAD ||
|
||||
io_context == IOCONTEXT_NORMAL ||
|
||||
io_context == IOCONTEXT_VACUUM)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -507,6 +538,8 @@ pgstat_tracks_io_op(BackendType bktype, IOObject io_object,
|
||||
if (io_object == IOOBJECT_WAL && io_op == IOOP_READ &&
|
||||
(bktype == B_WAL_RECEIVER || bktype == B_BG_WRITER ||
|
||||
bktype == B_AUTOVAC_LAUNCHER || bktype == B_AUTOVAC_WORKER ||
|
||||
bktype == B_DATACHECKSUMSWORKER_LAUNCHER ||
|
||||
bktype == B_DATACHECKSUMSWORKER_WORKER ||
|
||||
bktype == B_WAL_WRITER))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -52,19 +52,12 @@ client backend|temp relation|normal
|
||||
client backend|wal|init
|
||||
client backend|wal|normal
|
||||
datachecksums launcher|relation|bulkread
|
||||
datachecksums launcher|relation|bulkwrite
|
||||
datachecksums launcher|relation|init
|
||||
datachecksums launcher|relation|normal
|
||||
datachecksums launcher|relation|vacuum
|
||||
datachecksums launcher|temp relation|normal
|
||||
datachecksums launcher|wal|init
|
||||
datachecksums launcher|wal|normal
|
||||
datachecksums worker|relation|bulkread
|
||||
datachecksums worker|relation|bulkwrite
|
||||
datachecksums worker|relation|init
|
||||
datachecksums worker|relation|normal
|
||||
datachecksums worker|relation|vacuum
|
||||
datachecksums worker|temp relation|normal
|
||||
datachecksums worker|wal|init
|
||||
datachecksums worker|wal|normal
|
||||
io worker|relation|bulkread
|
||||
@@ -111,7 +104,7 @@ walsummarizer|wal|init
|
||||
walsummarizer|wal|normal
|
||||
walwriter|wal|init
|
||||
walwriter|wal|normal
|
||||
(95 rows)
|
||||
(88 rows)
|
||||
\a
|
||||
-- ensure that both seqscan and indexscan plans are allowed
|
||||
SET enable_seqscan TO on;
|
||||
|
||||
Reference in New Issue
Block a user