mirror of
https://github.com/postgres/postgres.git
synced 2025-07-24 14:22:24 +03:00
Add target "slru" to pg_stat_reset_shared()
Currently, pg_stat_reset_shared() cannot reset the counters in the view
pg_stat_slru even if it is a type of shared stats. This patch adds
support for a new value in pg_stat_reset_shared(), called "slru", able
to do that. Note that pg_stat_reset_shared(NULL) also resets SLRU
counters.
There may be a point in removing pg_stat_reset_slru() that was
introduced in 28cac71bd3
(v13~) as the new option overlaps with this
function, but we would lose the ability to reset individual SLRU
counters. This is left for future reconsideration.
Author: Atsushi Torikoshi
Discussion: https://postgr.es/m/e3c25d72e81378e7b64f3c52e0306fc9@oss.nttdata.com
This commit is contained in:
@ -1695,6 +1695,7 @@ pg_stat_reset_shared(PG_FUNCTION_ARGS)
|
||||
pgstat_reset_of_kind(PGSTAT_KIND_CHECKPOINTER);
|
||||
pgstat_reset_of_kind(PGSTAT_KIND_IO);
|
||||
XLogPrefetchResetStats();
|
||||
pgstat_reset_of_kind(PGSTAT_KIND_SLRU);
|
||||
pgstat_reset_of_kind(PGSTAT_KIND_WAL);
|
||||
|
||||
PG_RETURN_VOID();
|
||||
@ -1712,13 +1713,15 @@ pg_stat_reset_shared(PG_FUNCTION_ARGS)
|
||||
pgstat_reset_of_kind(PGSTAT_KIND_IO);
|
||||
else if (strcmp(target, "recovery_prefetch") == 0)
|
||||
XLogPrefetchResetStats();
|
||||
else if (strcmp(target, "slru") == 0)
|
||||
pgstat_reset_of_kind(PGSTAT_KIND_SLRU);
|
||||
else if (strcmp(target, "wal") == 0)
|
||||
pgstat_reset_of_kind(PGSTAT_KIND_WAL);
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("unrecognized reset target: \"%s\"", target),
|
||||
errhint("Target must be \"archiver\", \"bgwriter\", \"checkpointer\", \"io\", \"recovery_prefetch\", or \"wal\".")));
|
||||
errhint("Target must be \"archiver\", \"bgwriter\", \"checkpointer\", \"io\", \"recovery_prefetch\", \"slru\", or \"wal\".")));
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
Reference in New Issue
Block a user