1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-04 12:02:48 +03:00

Have autovacuum report its activities to the stat collector.

This commit is contained in:
Alvaro Herrera
2006-05-19 15:15:38 +00:00
parent 3a3622c5f0
commit e5ab52b273
4 changed files with 96 additions and 12 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.26 2005/10/17 16:24:19 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.26.2.1 2006/05/19 15:15:38 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -389,6 +389,7 @@ Datum
pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS)
{
PgStat_StatBeEntry *beentry;
SockAddr zero_clientaddr;
int32 beid;
char remote_host[NI_MAXHOST];
int ret;
@@ -405,6 +406,12 @@ pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS)
if (!superuser() && beentry->userid != GetUserId())
PG_RETURN_NULL();
/* A zeroed client addr means we don't know */
memset(&zero_clientaddr, 0, sizeof(zero_clientaddr));
if (memcmp(&(beentry->clientaddr), &zero_clientaddr,
sizeof(zero_clientaddr) == 0))
PG_RETURN_NULL();
switch (beentry->clientaddr.addr.ss_family)
{
case AF_INET:
@@ -432,6 +439,7 @@ Datum
pg_stat_get_backend_client_port(PG_FUNCTION_ARGS)
{
PgStat_StatBeEntry *beentry;
SockAddr zero_clientaddr;
int32 beid;
char remote_port[NI_MAXSERV];
int ret;
@@ -448,6 +456,12 @@ pg_stat_get_backend_client_port(PG_FUNCTION_ARGS)
if (!superuser() && beentry->userid != GetUserId())
PG_RETURN_NULL();
/* A zeroed client addr means we don't know */
memset(&zero_clientaddr, 0, sizeof(zero_clientaddr));
if (memcmp(&(beentry->clientaddr), &zero_clientaddr,
sizeof(zero_clientaddr) == 0))
PG_RETURN_NULL();
switch (beentry->clientaddr.addr.ss_family)
{
case AF_INET: