mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
pgstat: prepare APIs used by pgstatfuncs for shared memory stats.
With the introduction of PgStat_Kind PgStat_Single_Reset_Type, PgStat_Shared_Reset_Target don't make sense anymore. Replace them with PgStat_Kind. Instead of having dedicated reset functions for different kinds of stats, use two generic helper routines (one to reset all stats of a kind, one to reset one stats entry). A number of reset functions were named pgstat_reset_*_counter(), despite affecting multiple counters. The generic helper routines get rid of pgstat_reset_single_counter(), pgstat_reset_subscription_counter(). Rename pgstat_reset_slru_counter(), pgstat_reset_replslot_counter() to pgstat_reset_slru(), pgstat_reset_replslot() respectively, and have them only deal with a single SLRU/slot. Resetting all SLRUs/slots goes through the generic pgstat_reset_of_kind(). Previously pg_stat_reset_replication_slot() used SearchNamedReplicationSlot() to check if a slot exists. API wise it seems better to move that to pgstat_replslot.c. This is done separately from the - quite large - shared memory statistics patch to make review easier. Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de
This commit is contained in:
@@ -20,27 +20,6 @@
|
||||
#include "utils/pgstat_internal.h"
|
||||
|
||||
|
||||
/*
|
||||
* Reset counters for a single subscription, or all subscriptions (when subid
|
||||
* is InvalidOid).
|
||||
*
|
||||
* Permission checking for this function is managed through the normal
|
||||
* GRANT system.
|
||||
*/
|
||||
void
|
||||
pgstat_reset_subscription_counter(Oid subid)
|
||||
{
|
||||
PgStat_MsgResetsubcounter msg;
|
||||
|
||||
if (pgStatSock == PGINVALID_SOCKET)
|
||||
return;
|
||||
|
||||
msg.m_subid = subid;
|
||||
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_RESETSUBCOUNTER);
|
||||
|
||||
pgstat_send(&msg, sizeof(msg));
|
||||
}
|
||||
|
||||
/*
|
||||
* Report a subscription error.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user