Re: log_hostname and pg_stat_activity

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Steve Singer <ssinger_pg(at)sympatico(dot)ca>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: log_hostname and pg_stat_activity
Date: 2011-02-17 01:59:10
Message-ID: AANLkTi=kL=PRtM4hkvZ1RZUimPXaG8RrzOzu+ZjFpKT_@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 10, 2011 at 10:40 AM, Steve Singer <ssinger_pg(at)sympatico(dot)ca> wrote:
> On 11-02-10 10:32 AM, Robert Haas wrote:
>> I was assuming those changes were sufficiently trivial that they could
>> be made at commit-time, especially if Peter is committing it himself.
>> Of course if he'd like a re-review, he can always post an updated
>> patch, but I just thought that was overly pedantic in this particular
>> case.
>
> Sounds reasonable.

I rebased this patch, wrote documentation, and fixed
BackendStatusShmemSize. PFA.

On further review, I'm inclined to go with Peter's original approach
to displaying the hostname: show it if we have it, and don't if we
don't. It's not that hard to document the relevant criteria, and it
seems silly to suppress the information if we have it.

I had a thought of declaring st_clienthostname as char
st_clienthostname[NAMEDATALEN] rather than char *st_clienthostname.
That would simplify the initialization code. But I believe that the
protocol used for updating this data structure is unsafe unless the
whole thing fits into a single cache line. I'm not positive that's
going to be true on every architecture even as things stand. On my
Mac, with this patch, it's 208 bytes (which means that it's presumably
200 without the patch, and that it would be 264 with the alternate
approach proposed above). According to that font of knowledge,
Wikipedia, the size of a cache line can vary from 8 to 512 bytes
[citation needed].

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2011-02-17 02:00:05 Re: Debian readline/libedit breakage
Previous Message Stephen Frost 2011-02-17 01:58:57 Re: Add support for logging the current role