[pgpool-hackers: 3497] Re: [Proposal] Check if socket file exists at startup and remove them if PID file doesn't exist.

Bo Peng pengbo at sraoss.co.jp
Thu Jan 23 12:12:41 JST 2020


Hello,

On Thu, 23 Jan 2020 11:47:36 +0900 (JST)
Tatsuo Ishii <ishii at sraoss.co.jp> wrote:

> > But, when I change ereport(...) -> fprintf(stderr...),
> > 
> > 
> >        if (pid > 0)
> >           {   
> >               if (kill(pid, 0) == 0)
> >               {   
> >                   fprintf(stderr, "pid file found. is another pgpool(%d) is running?\n", pid);
> >               }   
> >               else
> >               {   
> >                   fprintf(stderr, "pid file found but it seems bogus. Trying to start pgpool anyway...\n");                              
> >               }   
> >           } 
> > 
> > the messages are redirected to log file, instead of standard output.
> > Is it expected behavior?
> 
> Sure. Because you redirected pgpool's stderror to the log file, didn't you?

Yes. I redirected pgpool's standard error to log file.

And I forgot to add "exit(EXIT_FAILURE);" after the first "fprintf()".
Without that pid file will be deleted.

New patch is attached.

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


-- 
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS, Inc. Japan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove_socket_files_v2.patch
Type: application/octet-stream
Size: 1090 bytes
Desc: not available
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200123/c228209d/attachment.obj>


More information about the pgpool-hackers mailing list