<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hello Tatsuo, thanks for your explanation!</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">So, if i understand correctly, we have two cases:<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">(1) for new users added to pool_passwd: they are instantly available because they are always mapped to an empty connection slot (as no cached connection will ever be found for a new user)</div><div class="gmail_default" style="font-family:tahoma,sans-serif"> </div><div class="gmail_default" style="font-family:tahoma,sans-serif">(2) for users edited/deleted from pool_passwd: these users may remain stale for a while, but will be eventually consistent when cached connections are recycled (eg. as a result of <a name="GUC-CHILD-MAX-CONNECTIONS"></a><tt class="gmail-VARNAME">child_max_connections or </tt><a name="GUC-CHILD-LIFE-TIME"></a><tt class="gmail-VARNAME">child_life_time</tt>) <br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"> </div><div class="gmail_default" style="font-family:tahoma,sans-serif">Kind regards, Michail<br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 20, 2024 at 2:31 PM Tatsuo Ishii <<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I have updated docs to clarify reloading of pool_passwd file.<br>
<br>
<a href="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=4695affe7859338fa41d860dac74bfbebea7a88a" rel="noreferrer" target="_blank">https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=4695affe7859338fa41d860dac74bfbebea7a88a</a><br>
<br>
> Thanks for your explanation.<br>
> <br>
> On Mon, Aug 19, 2024 at 7:49 PM Tatsuo Ishii <<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>> wrote:<br>
> <br>
>> Hi Michail,<br>
>><br>
>> > Hello Tatsuo,<br>
>> ><br>
>> > Yes, my test is as follows (on Pgpool 4.4.6, running on a RedHat 8<br>
>> > container [1]).<br>
>> ><br>
>> > The pool_passwd file is located at a custom path:<br>
>> > $ grep /etc/pgpool-II/pgpool.conf -P -e 'pool_passwd\s*='<br>
>> > pool_passwd = '/var/lib/pgpool/pool-passwd/pool_passwd'<br>
>> ><br>
>> > Create a list of new users to feed pg_enc utility:<br>
>> > $ echo 'user1:secret1' > /tmp/new-users.txt<br>
>> > $ pg_enc -k $PGPOOLKEYFILE -i /tmp/new-users.txt -m # writes entries to<br>
>> > /etc/pgpool-II/pool_passwd<br>
>> ><br>
>> > Append new entries (assuming /etc/pgpool-II/pool_passwd was initially<br>
>> > empty) to our custom pool_passwd (contents change, inode of target<br>
>> remains<br>
>> > the same):<br>
>> > $ cat /etc/pgpool-II/pool_passwd >><br>
>> /var/lib/pgpool/pool-passwd/pool_passwd<br>
>> ><br>
>> > Connect with new user "user1" (it works, without reloading).<br>
>><br>
>> I have looked into the case more and found that:<br>
>><br>
>> 1) If the pgpool child process had never accepted connections from<br>
>> client, the process reads the contents of pool_passwd and the changes<br>
>> you made were picked up.<br>
>><br>
>> 2) Actually pgpool reads pool_passwd every time when authentication is<br>
>> required by client.<br>
>><br>
>> So you are right. The change made to pool_passwd will be effective<br>
>> without reload.<br>
>><br>
>> Note that if changes are made to pool_hba.conf, reload is required.<br>
>><br>
>> Best reagards,<br>
>> --<br>
>> Tatsuo Ishii<br>
>> SRA OSS K.K.<br>
>> English: <a href="http://www.sraoss.co.jp/index_en/" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en/</a><br>
>> Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
>><br>
>> > [1]<br>
>> ><br>
>> <a href="https://github.com/OpertusMundi/postgresql-cluster.helm/blob/master/pgpool/redhat/Dockerfile" rel="noreferrer" target="_blank">https://github.com/OpertusMundi/postgresql-cluster.helm/blob/master/pgpool/redhat/Dockerfile</a><br>
>> ><br>
>> > Kind regards, Michail<br>
>> ><br>
>> ><br>
>> > On Mon, Aug 19, 2024 at 12:14 PM Tatsuo Ishii <<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>><br>
>> wrote:<br>
>> ><br>
>> >> > Hello Tatsuo and thanks for your quick response!<br>
>> >> ><br>
>> >> > My impression is that (as Ron also mentioned) the contents of<br>
>> pool_passwd<br>
>> >> > are read on every connection (authentication) attempt. I mean, at<br>
>> least<br>
>> >> for<br>
>> >> > a handful of tests I performed, the new users were seen without a need<br>
>> >> for<br>
>> >> > a reload (but this could also be luck[1]). So, is a reload really<br>
>> >> necessary<br>
>> >> > here?<br>
>> >> ><br>
>> >> > [1] e.g some Pgpool child processes see the updated version of<br>
>> >> pool_passwd,<br>
>> >> > while others see the old (cached?) one<br>
>> >><br>
>> >> I confirmed using gdb that without pgpool reload, pool_passwd is never<br>
>> >> re-read at least on master branch. Are you sure that you are the only<br>
>> >> user of pgpool at that point? I suspect someone else executed pgpool<br>
>> >> reload.<br>
>> >><br>
>> >> Best reagards,<br>
>> >> --<br>
>> >> Tatsuo Ishii<br>
>> >> SRA OSS K.K.<br>
>> >> English: <a href="http://www.sraoss.co.jp/index_en/" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en/</a><br>
>> >> Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
>> >><br>
>><br>
> <br>
> <br>
> -- <br>
> Death to America, and butter sauce.<br>
> Iraq lobster!<br>
</blockquote></div>