MCPcopy Create free account
hub / github.com/apache/cloudberry / pgstat_reset_shared_counters

Function pgstat_reset_shared_counters

src/backend/postmaster/pgstat.c:1456–1478  ·  view source on GitHub ↗

---------- * pgstat_reset_shared_counters() - * * Tell the statistics collector to reset cluster-wide shared counters. * * Permission checking for this function is managed through the normal * GRANT system. * ---------- */

Source from the content-addressed store, hash-verified

1454 * ----------
1455 */
1456void
1457pgstat_reset_shared_counters(const char *target)
1458{
1459 PgStat_MsgResetsharedcounter msg;
1460
1461 if (pgStatSock == PGINVALID_SOCKET)
1462 return;
1463
1464 if (strcmp(target, "archiver") == 0)
1465 msg.m_resettarget = RESET_ARCHIVER;
1466 else if (strcmp(target, "bgwriter") == 0)
1467 msg.m_resettarget = RESET_BGWRITER;
1468 else if (strcmp(target, "wal") == 0)
1469 msg.m_resettarget = RESET_WAL;
1470 else
1471 ereport(ERROR,
1472 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1473 errmsg("unrecognized reset target: \"%s\"", target),
1474 errhint("Target must be \"archiver\", \"bgwriter\", or \"wal\".")));
1475
1476 pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_RESETSHAREDCOUNTER);
1477 pgstat_send(&msg, sizeof(msg));
1478}
1479
1480/* ----------
1481 * pgstat_reset_single_counter() -

Callers 1

pg_stat_reset_sharedFunction · 0.85

Calls 5

pgstat_setheaderFunction · 0.85
pgstat_sendFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
errhintFunction · 0.50

Tested by

no test coverage detected