Re: log_hostname and pg_stat_activity

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: log_hostname and pg_stat_activity
Дата
Msg-id 1295296247-sup-6397@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: log_hostname and pg_stat_activity  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Excerpts from Peter Eisentraut's message of sáb ene 15 13:15:45 -0300 2011:

> Here is a patch that adds a client_hostname field to pg_stat_activity.
> It takes the hostname if it is available either by having log_hostname
> set or if the pg_hba.conf processing resolved it.  So I think for most
> people who would care about this thing, it would "just work".
> 
> I'm not so sure about the pgstat.c internals.  Do we need the separate
> buffer in shared memory, as in this patch, or could we just copy the
> name directly into the PgBackendStatus struct?  I guess not the latter,
> since my compiler complains about copying a string into a volatile
> pointer.

I think you should do it like clientaddr is handled: fill a string with
the value from MyProcPort, then make the PgBackendStatus point to that.

BTW you need to touch BackendStatusShmemSize if you change the routine
below that (but AFAIU that should be taken out).

...

I'm confused ... why isn't this code broken?  I don't understand why
isn't clientaddr clobbered the next time someone uses the stack space,
given that it's not allocated anywhere.

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: texteq/byteaeq: avoid detoast [REVIEW]
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug in pg_describe_object, patch v2