Lists: | pgsql-hackers |
---|
From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | debug log in pg_archivecleanup |
Date: | 2010-06-15 09:40:39 |
Message-ID: | AANLkTilKokIBVfIPutiHyyxh8e0R3YYrHJwipK2Tuz_2@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi,
Sometimes the postgres server log message and the pg_archivecleanup debug
message are output in the same line as follows. This is a little hard to
read.
-----------------------
LOG: restored log file "00000001000000000000006B" from archive
pg_archivecleanup: keep WAL file 000000010000000000000068 and later
pg_archivecleanup: removing
"/dav/head-pgsql/act.arh/000000010000000000000048"LOG: restored log
file "00000001000000000000006C" from archive
pg_archivecleanup: removing "/dav/head-pgsql/act.arh/000000010000000000000061"
pg_archivecleanup: removing "/dav/head-pgsql/act.arh/00000001000000000000004D"
pg_archivecleanup: removing "/dav/head-pgsql/act.arh/00000001000000000000005C"
-----------------------
This is because pg_archivecleanup puts the line break "\n" in the head of
debug message. Why should we do so?
-----------------------
if (debug)
fprintf(stderr, "\n%s: removing \"%s\"", progname, WALFilePath);
-----------------------
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
From: | Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: debug log in pg_archivecleanup |
Date: | 2010-06-16 03:24:34 |
Message-ID: | 20100616122433.B406.52131E4D@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> This is because pg_archivecleanup puts the line break "\n" in the head of
> debug message. Why should we do so?
>
> -----------------------
> if (debug)
> fprintf(stderr, "\n%s: removing \"%s\"", progname, WALFilePath);
> -----------------------
We also need "\n" at line 308.
L.125: fprintf(stderr, "\n%s: removing \"%s\"", progname, WALFilePath);
L.308: fprintf(stderr, "%s: keep WAL file %s and later", progname, exclusiveCleanupFileName);
Note that we don't need a line break at Line 130
because strerror() fills the last %s.
L.130: fprintf(stderr, "\n%s: ERROR failed to remove \"%s\": %s",
Regards,
---
Takahiro Itagaki
NTT Open Source Software Center
From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: debug log in pg_archivecleanup |
Date: | 2010-06-17 06:26:46 |
Message-ID: | AANLkTilfZBRfYs3bdpNzbwPA23SRJbWvI4i5gdGDMLbM@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Jun 16, 2010 at 12:24 PM, Takahiro Itagaki
<itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>
> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
>> This is because pg_archivecleanup puts the line break "\n" in the head of
>> debug message. Why should we do so?
>>
>> -----------------------
>> if (debug)
>> fprintf(stderr, "\n%s: removing \"%s\"", progname, WALFilePath);
>> -----------------------
>
> We also need "\n" at line 308.
> L.125: fprintf(stderr, "\n%s: removing \"%s\"", progname, WALFilePath);
> L.308: fprintf(stderr, "%s: keep WAL file %s and later", progname, exclusiveCleanupFileName);
Yes. What about the attached patch?
> Note that we don't need a line break at Line 130
> because strerror() fills the last %s.
> L.130: fprintf(stderr, "\n%s: ERROR failed to remove \"%s\": %s",
Right.
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
archivecleanup_line_break_v1.patch | application/octet-stream | 1.4 KB |
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
Cc: | Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: debug log in pg_archivecleanup |
Date: | 2010-06-17 17:33:23 |
Message-ID: | 22143.1276796003@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> On Wed, Jun 16, 2010 at 12:24 PM, Takahiro Itagaki
> <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
>> This is because pg_archivecleanup puts the line break "\n" in the head of
>> debug message. Why should we do so?
> Yes. What about the attached patch?
Applied along with a bit of further editorialization.
>> Note that we don't need a line break at Line 130
>> because strerror() fills the last %s.
>> L.130: fprintf(stderr, "\n%s: ERROR failed to remove \"%s\": %s",
> Right.
Huh? strerror() doesn't include a newline.
regards, tom lane
From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: debug log in pg_archivecleanup |
Date: | 2010-06-18 08:51:16 |
Message-ID: | 1276851076.23257.81482.camel@ebony |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, 2010-06-17 at 13:33 -0400, Tom Lane wrote:
> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> > On Wed, Jun 16, 2010 at 12:24 PM, Takahiro Itagaki
> > <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> wrote:
> >> This is because pg_archivecleanup puts the line break "\n" in the head of
> >> debug message. Why should we do so?
>
> > Yes. What about the attached patch?
>
> Applied along with a bit of further editorialization.
>
> >> Note that we don't need a line break at Line 130
> >> because strerror() fills the last %s.
> >> L.130: fprintf(stderr, "\n%s: ERROR failed to remove \"%s\": %s",
>
> > Right.
>
> Huh? strerror() doesn't include a newline.
Thanks.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Training and Services