VACUUM messages without newlines

Lists: pgsql-hackers
From: Thom Brown <thombrown(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: VACUUM messages without newlines
Date: 2010-06-01 15:16:33
Message-ID: AANLkTik89BxK-DK84mljp06IUzxehw7fJIyP8bpmRwaL@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

This has annoyed me for some time, but it appears that in the VACUUM
log, the line which says...

INFO: analyzing "%s.%s"

...( and appears in pgsql/src/backend/commands/analyze.c lines 282 and
287 ) doesn't terminate with a newline, meaning the next message
appears immediately after it. Either the errmsg function should be
doing this, or should be included explicitly in the message itself as
it does with all other messages output to VACUUM logs.

The same goes for...

CPU %d.%02ds/%d.%02du sec elapsed %d.%02d sec

... as appearing in pgsql/src/backend/utils/misc/pg_rusage.c (line 64)

and

"%s": scanned %d of %u pages, containing %.0f live rows and %.0f dead
rows; %d rows in sample, %.0f estimated total rows

... in pgsql/src/backend/commands/analyze.c (line 1220).

Could this be changed, or is there a reason these have to be logged this way?

Thanks

Thom


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VACUUM messages without newlines
Date: 2010-06-01 15:28:41
Message-ID: 1275405940-sup-4136@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Excerpts from Thom Brown's message of mar jun 01 11:16:33 -0400 2010:
> This has annoyed me for some time, but it appears that in the VACUUM
> log, the line which says...
>
> INFO: analyzing "%s.%s"
>
> ...( and appears in pgsql/src/backend/commands/analyze.c lines 282 and
> 287 ) doesn't terminate with a newline, meaning the next message
> appears immediately after it.

The message pieces are sent separately. They are only crammed in a
single line if the interface is using the old mechanism to extract error
message info; anything built after cca. 2002 should be reading fields
separately, and printing them in separate lines.

> The same goes for...
>
> CPU %d.%02ds/%d.%02du sec elapsed %d.%02d sec

Now you can argue that this line is too long, but that's a different
problem than the one above.

> "%s": scanned %d of %u pages, containing %.0f live rows and %.0f dead
> rows; %d rows in sample, %.0f estimated total rows

This too.

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


From: Thom Brown <thombrown(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VACUUM messages without newlines
Date: 2010-06-01 15:34:38
Message-ID: AANLkTinUqzInEKuuorXg54j6Dvg58k9KWrfKZCXI1oyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 1 June 2010 16:28, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> Excerpts from Thom Brown's message of mar jun 01 11:16:33 -0400 2010:
>> This has annoyed me for some time, but it appears that in the VACUUM
>> log, the line which says...
>>
>> INFO: analyzing "%s.%s"
>>
>> ...( and appears in pgsql/src/backend/commands/analyze.c lines 282 and
>> 287  ) doesn't terminate with a newline, meaning the next message
>> appears immediately after it.
>
> The message pieces are sent separately.  They are only crammed in a
> single line if the interface is using the old mechanism to extract error
> message info; anything built after cca. 2002 should be reading fields
> separately, and printing them in separate lines.

I see what you mean. I'm seeing this in the latest version of pgAdmin
III (1.10.3) so looks like it's not up-to-date in that respect.
Should report it as a pgAdmin problem then?

Thanks

Thom


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VACUUM messages without newlines
Date: 2010-06-01 15:50:42
Message-ID: 4169.1275407442@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Thom Brown <thombrown(at)gmail(dot)com> writes:
> I see what you mean. I'm seeing this in the latest version of pgAdmin
> III (1.10.3) so looks like it's not up-to-date in that respect.
> Should report it as a pgAdmin problem then?

Yes. The message texts in ereport() calls are *not* supposed to have
trailing newlines. If you don't like the way it's presented on the
client side, that's a client-side problem.

regards, tom lane


From: Thom Brown <thombrown(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VACUUM messages without newlines
Date: 2010-06-01 15:59:35
Message-ID: AANLkTim93yPdOt4MW4c-ldhoK-fi7tftoqjF1b5rlrGJ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 1 June 2010 16:50, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thom Brown <thombrown(at)gmail(dot)com> writes:
>> I see what you mean.  I'm seeing this in the latest version of pgAdmin
>> III (1.10.3) so looks like it's not up-to-date in that respect.
>> Should report it as a pgAdmin problem then?
>
> Yes.  The message texts in ereport() calls are *not* supposed to have
> trailing newlines.  If you don't like the way it's presented on the
> client side, that's a client-side problem.
>
>                        regards, tom lane
>

Yes, I can see that now. I'd looked up other messages which appear in
the log and noticed they were terminated with newlines in the
back-end, but I guess those were of a different type and happen to
share the same output.

Thanks

Thom


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VACUUM messages without newlines
Date: 2010-06-01 16:00:58
Message-ID: 1275407372-sup-3116@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Excerpts from Thom Brown's message of mar jun 01 11:34:38 -0400 2010:
> On 1 June 2010 16:28, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:

> > The message pieces are sent separately.  They are only crammed in a
> > single line if the interface is using the old mechanism to extract error
> > message info; anything built after cca. 2002 should be reading fields
> > separately, and printing them in separate lines.
>
> I see what you mean. I'm seeing this in the latest version of pgAdmin
> III (1.10.3) so looks like it's not up-to-date in that respect.
> Should report it as a pgAdmin problem then?

Hmm, I wouldn't expect pgAdmin to behave this way.

[ tests ... ]

Hey, I see a problem here. After the last INFO message (which is not
the same you mentioned, at least in this server version) my server
crashed for whatever reason, and the error report for that got stuffed
in the same line, and it didn't have the FATAL leader either. Pretty
weird. I'm fairly sure this is pgAdmin's doing, 'cause psql doesn't
behave this way.

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VACUUM messages without newlines
Date: 2010-06-01 16:04:28
Message-ID: 4440.1275408268@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Thom Brown <thombrown(at)gmail(dot)com> writes:
> Yes, I can see that now. I'd looked up other messages which appear in
> the log and noticed they were terminated with newlines in the
> back-end, but I guess those were of a different type and happen to
> share the same output.

Hm, sure you're not thinking of frontend code? We generally do include
trailing newlines in message texts on that side, but elog/ereport on
the backend side should never have them.

regards, tom lane