[pgpool-hackers: 660] Re: logging using fprintf in pgpool_main.c

Tatsuo Ishii ishii at postgresql.org
Wed Nov 12 18:10:16 JST 2014


Yes, I forgot that.

However, removing the fprintf par breaks regression test.
What the regression test expects is:

	grep 'failover done. shutdown host /tmp(11001)' log/pgpool.log > /dev/null 2>&1

succeeds. Apparently this part:

>> 1803             ereport(LOG,
>> 1804                     (errmsg("failover done. shutdown host %s(%d)",
>> 1805                      BACKEND_INFO(node_id).backend_hostname,
>> 1806                      BACKEND_INFO(node_id).backend_port)));

has some problem with it.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

> Hi Yugo,
> 
> I have no idea about the reason for.
> Looking at the git log, Apparently this fprintf() is added by Tatsuo's commit
> "commit id: efa74af06f1c6640a1b5d8c35763965b04e8cf10"
> 
> Regards,
> Muhammad Usama
> 
> 
> 
> On Wed, Nov 12, 2014 at 12:31 PM, Yugo Nagata <nagata at sraoss.co.jp> wrote:
>> Hi Usama,
>>
>> I found an odd code in main/pgpool_main.c;
>>
>> 1798             /* Temporary black magic. Without this regression 055 does not finish */
>> 1799             fprintf(stderr, "failover done. shutdown host %s(%d)",
>> 1800                      BACKEND_INFO(node_id).backend_hostname,
>> 1801                     BACKEND_INFO(node_id).backend_port);
>> 1802
>> 1803             ereport(LOG,
>> 1804                     (errmsg("failover done. shutdown host %s(%d)",
>> 1805                      BACKEND_INFO(node_id).backend_hostname,
>> 1806                      BACKEND_INFO(node_id).backend_port)));
>>
>> I couldn't understand why fprintf is used here. Something of workaround or
>> temporary code for debug? Could you please explain your intention?
>>
>> When a backend goes down, pgpool outputs messages like this;
>>
>> 2014-11-12 16:05:30: pid 32371: LOG:  worker process received restart request
>> failover done. shutdown host /tmp(11000)2014-11-12 16:05:30: pid 32011: LOG:  failover done. shutdown host /tmp(11000)
>> 2014-11-12 16:05:31: pid 32370: LOG:  restart request received in pcp child process
>>
>> There are two lines of "failover done. ...", and the next message starts
>> from halfway of line since fprintf doesn't output \n.
>>
>> Regards,
>>
>> --
>> Yugo Nagata <nagata at sraoss.co.jp>
> _______________________________________________
> pgpool-hackers mailing list
> pgpool-hackers at pgpool.net
> http://www.pgpool.net/mailman/listinfo/pgpool-hackers


More information about the pgpool-hackers mailing list