1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Have autovacuum report its activities to the stat collector.

This commit is contained in:
Alvaro Herrera
2006-05-19 15:15:37 +00:00
parent 4adab7eed3
commit 49b3462abb
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.27 2006/03/05 15:58:43 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/pgstatfuncs.c,v 1.28 2006/05/19 15:15:37 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: