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

Yugo Nagata nagata at sraoss.co.jp
Wed Nov 12 16:31:58 JST 2014


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>


More information about the pgpool-hackers mailing list