<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 20, 2017 at 5:12 AM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Usama,<br>
<br>
Thanks for the patch.<br>
<br>
I think this is good since we didn&#39;t define the behavior when a<br>
relative path is specified for pid_file_name anyway. Now it&#39;s defined,<br>
which is good.<br></blockquote><div><br></div><div>Thanks</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Just out of curiosity, is there any use case to define the path of<br>
pid_file_name relative to the path of pgpool.conf? Since most users<br>
(and Linux systems) want to put pid_file_name under /var while they<br>
want to put pgpool.conf under /etc.<br></blockquote><div><br></div><div>Well the main motivation behind this pid_file_name change was to solve the confusion, since it has also confused me few times, and it is easy to get it wrong.</div><div>And I was thinking it as a step towards making the pgpool configurations self contained,</div><div>Like for example if we define the behaviour of each path related configuration parameter in the pgpool.conf than we would be able to copy paste the pgpool directory to different path or system and will be able to run the pgpool without modifying the pgpool.conf file, This feature would be useful in for certain lab /cloud environments, but yes its still someway to go to achieve that.</div><div><br></div><div>And as for now, I think you are right most of the users use /var for pid file and /etc for config and there may exist a very few use cases for this currently. </div><div><br></div><div>Thanks</div><div>Best Regards</div><div>Muhammad Usama</div><div> </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_<wbr>en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.<wbr>jp</a><br>
<br>
&gt; Hi Ishii-San<br>
&gt;<br>
&gt; Can you please have a look at the attached patch.<br>
&gt; The reason I want your consent before committing it is because apart from<br>
&gt; using the absolute paths for pgpool.conf, pcp.conf and pool_hba.conf files,<br>
&gt; I have also modified the behaviour of pid_file_name configuration parameter.<br>
&gt; Now when the relative path is specified for the pid file in pgpool.conf<br>
&gt; file that relative path is calculated with reference to the location of<br>
&gt; pgpool.conf file.<br>
&gt;<br>
&gt; For example:<br>
&gt;<br>
&gt; if pgpool.conf file sets pid_file_name parameter as<br>
&gt;<br>
&gt; pid_file_name = &#39;somedir/pgpool.pid&#39;<br>
&gt;<br>
&gt; And pgpool.conf file is located in the &quot;/etc/configurations/&quot; directory<br>
&gt; than the Pgpool-II will create the pgpool.pid file<br>
&gt; in &quot;/etc/configurations/somedir&quot; directory<br>
&gt;<br>
&gt; While if absolute path is specified than it will work as it works before<br>
&gt;<br>
&gt; pid_file_name = &#39;/etc/mydir/pgpool.pid&#39; # this will create the pgpool.pid<br>
&gt; in /etc/mydir/ directory<br>
&gt;<br>
&gt;<br>
&gt; I have done this change because I think it will make the configuration of<br>
&gt; pid_file_name more intuitive and less confusing.<br>
&gt; P.S  The documentation changes are also part of the patch.<br>
&gt;<br>
&gt; Thoughts and comments?<br>
&gt;<br>
&gt;<br>
&gt; Thanks<br>
&gt; Best regards<br>
&gt; Muhammad Usama<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Wed, Jun 14, 2017 at 3:27 AM, Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Good catch! Please go ahead.<br>
&gt;&gt;<br>
&gt;&gt; Best regards,<br>
&gt;&gt; --<br>
&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_<wbr>en.php</a><br>
&gt;&gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.<wbr>jp</a><br>
&gt;&gt;<br>
&gt;&gt; &gt; Hi<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Pgpool-II does not properly handle the relative paths especially when the<br>
&gt;&gt; &gt; pgpool.conf file is explicitly specified using the command line (-f<br>
&gt;&gt; switch)<br>
&gt;&gt; &gt; while its patch is given relative to the current directory.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; For example:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Suppose we invoke pgpool-II from &quot;/home/work/installed/pgpool/<wbr>bin&quot;<br>
&gt;&gt; directory<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; $ pwd<br>
&gt;&gt; &gt; /home/work//installed/pgpool/<wbr>bin<br>
&gt;&gt; &gt; $ ./pgpool -f simple_conf/pgpool.conf<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Now we are expecting here is that the Pgpool-II will look for pgpool.conf<br>
&gt;&gt; &gt; file in the<br>
&gt;&gt; &gt; /home/work/installed/pgpool/<wbr>bin/simple_conf/ directory, which it does<br>
&gt;&gt; &gt; correctly :-), and also latter in the startup phase when it will require<br>
&gt;&gt; &gt; the pool_passwd file it will look in the same (<br>
&gt;&gt; &gt; /home/work/installed/pgpool/<wbr>bin/simple_conf/)directory.<br>
&gt;&gt; &gt; So in the code what Pgpool-II does is, it take out the directory portion<br>
&gt;&gt; &gt; from the command line option provided to it for specifying the<br>
&gt;&gt; pgpool.conf<br>
&gt;&gt; &gt; file and look for the pool_passwd file in that directory. which in this<br>
&gt;&gt; &gt; case is just simple_conf/<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Now the problem here is since the pgpool.conf path used in the command<br>
&gt;&gt; line<br>
&gt;&gt; &gt; option was a relative path, so it will only be able to go to the correct<br>
&gt;&gt; &gt; directory location if the current directory of Pgpool-II remains the same<br>
&gt;&gt; &gt; from where it was invoked from.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; And since we do not change the current directory when Pgpool-II is<br>
&gt;&gt; started<br>
&gt;&gt; &gt; with &quot;-n&quot; switch ( non daemon mode) so everything works as expected in<br>
&gt;&gt; that<br>
&gt;&gt; &gt; mode.<br>
&gt;&gt; &gt; But when the Pgpool-II is started in the daemon mode the daemonize()<br>
&gt;&gt; &gt; function changes the current directory to &quot;/&quot;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; main.c:380 if(chdir(&quot;/&quot;))<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; and after that all relative path becomes invalid and Pgpool-II will start<br>
&gt;&gt; &gt; looking for files in invalid or non-existent location. which as per our<br>
&gt;&gt; &gt; example in daemon mode it will try to find the pool_passwd file in<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; /simple_conf/pool_passed<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; instead of<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; /home/work//installed/pgpool/<wbr>bin/simple_conf/pool_passwd<br>
&gt;&gt; &gt; The solution to this is to convert the relative path of the pgpool.conf<br>
&gt;&gt; to<br>
&gt;&gt; &gt; the absolute path at the startup and later use that absolute path for all<br>
&gt;&gt; &gt; other path calculations.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; If you do not have any reservation, than I will start working on the fix.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt; Best Regards<br>
&gt;&gt; &gt; Muhammad Usama<br>
&gt;&gt;<br>
</div></div></blockquote></div><br></div></div>