Re: command tag logging

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ray Stell <stellr(at)cns(dot)vt(dot)edu>
Cc: alvherre <alvherre(at)commandprompt(dot)com>, pgsql-admin <pgsql-admin(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: command tag logging
Date: 2010-05-27 18:23:06
Message-ID: 4976.1274984586@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

Ray Stell <stellr(at)cns(dot)vt(dot)edu> writes:
> On Thu, May 27, 2010 at 12:49:49PM -0400, Tom Lane wrote:
>> That is in the right place, isn't it. That would suggest that
>> get_ps_display() is returning a wrong length on Ray's machine.
>> It works okay here, but since that's platform-specific code that
>> hardly proves much. Ray, what platform is this exactly?

> [postgres ~]$ cat /etc/issue
> Red Hat Enterprise Linux Server release 5.5 (Tikanga)

OK, I can reproduce it when I try on my Fedora box. The problem is that
log_connections emits a log message before init_ps_display() has been
called, and the ps_status.c logic isn't careful to ensure that it
returns something sane in that case. It accidentally failed to fail
too badly before I changed the elog.c logic, because there'd be an
embedded null after the program name in most cases. I suppose people
might even have thought that printing "postmaster" or "postgres" for
%i was intended behavior there.

I think the most useful fix is to create a static variable to hold the
notional strlen(ps_buffer), which will initialize to zero, and then
we can use that instead of groveling over the string in get_ps_display.
Should improve performance a tad as well as fixing this problem.
Will work on that.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message alvherre 2010-05-27 19:29:28 Re: List traffic
Previous Message Josh Berkus 2010-05-27 18:11:51 Re: List traffic

Browse pgsql-hackers by date

  From Date Subject
Next Message Joseph Adams 2010-05-27 18:39:37 Re: JSON manipulation functions
Previous Message Josh Berkus 2010-05-27 18:17:15 Re: Idea for getting rid of VACUUM FREEZE on cold pages