mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 00:02:26 -04:00
There was a wild mishmash of function comment formatting in pgstat, making it hard to know what to use for any new function and hard to extend existing comments (particularly due to randomly different forms of indentation). Author: Andres Freund <andres@anarazel.de> Reviewed-By: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220329191727.mzzwbl7udhpq7pmf@alap3.anarazel.de Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de
70 lines
1.8 KiB
C
70 lines
1.8 KiB
C
/* -------------------------------------------------------------------------
|
|
*
|
|
* pgstat_subscription.c
|
|
* Implementation of subscription statistics.
|
|
*
|
|
* This file contains the implementation of subscription statistics. It is kept
|
|
* separate from pgstat.c to enforce the line between the statistics access /
|
|
* storage implementation and the details about individual types of
|
|
* statistics.
|
|
*
|
|
* Copyright (c) 2001-2022, PostgreSQL Global Development Group
|
|
*
|
|
* IDENTIFICATION
|
|
* src/backend/utils/activity/pgstat_subscription.c
|
|
* -------------------------------------------------------------------------
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
|
|
#include "utils/pgstat_internal.h"
|
|
|
|
|
|
/*
|
|
* Tell the statistics collector to reset a single subscription
|
|
* counter, or all subscription counters (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));
|
|
}
|
|
|
|
/*
|
|
* Tell the collector about the subscription error.
|
|
*/
|
|
void
|
|
pgstat_report_subscription_error(Oid subid, bool is_apply_error)
|
|
{
|
|
PgStat_MsgSubscriptionError msg;
|
|
|
|
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_SUBSCRIPTIONERROR);
|
|
msg.m_subid = subid;
|
|
msg.m_is_apply_error = is_apply_error;
|
|
pgstat_send(&msg, sizeof(PgStat_MsgSubscriptionError));
|
|
}
|
|
|
|
/*
|
|
* Tell the collector about dropping the subscription.
|
|
*/
|
|
void
|
|
pgstat_report_subscription_drop(Oid subid)
|
|
{
|
|
PgStat_MsgSubscriptionDrop msg;
|
|
|
|
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_SUBSCRIPTIONDROP);
|
|
msg.m_subid = subid;
|
|
pgstat_send(&msg, sizeof(PgStat_MsgSubscriptionDrop));
|
|
}
|