<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 8, 2013 at 2:32 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ahsan,<br>
<div class="im"><br>
&gt; Hi Tatsuo,<br>
&gt;<br>
&gt; Good to see that you found the problem. We have a customer who has been waiting for a fix for this issue for sometime.<br>
&gt;<br>
&gt; Which branches are you planning to commit this to and when?<br>
<br>
</div>The fix has been already committed to master, 3.2-stable and 3.1-stable.<br></blockquote><div><br></div><div style>Thanks Tatsuo. </div><div style><br></div><div style>Were you able to reproduce the issue? As i understand it wasn&#39;t straight forward to reproduce.</div>
<div style><br></div><div style> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; -- Ahsan<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt; Sender: <a href="mailto:pgpool-hackers-bounces@pgpool.net">pgpool-hackers-bounces@pgpool.net</a><br>
&gt; Date: Wed, 08 May 2013 18:02:03<br>
&gt; To: &lt;<a href="mailto:anaeem.it@gmail.com">anaeem.it@gmail.com</a>&gt;<br>
&gt; Cc: &lt;<a href="mailto:pgpool-hackers@pgpool.net">pgpool-hackers@pgpool.net</a>&gt;<br>
&gt; Subject: [pgpool-hackers: 231] Re: Unexpected behavior of pgpool-II<br>
&gt;<br>
&gt; Sorry for delay. I think I found a problem regarding %H for<br>
&gt; follow_master_command. Pgpool-II assigns it &quot;new master node&quot;, which<br>
&gt; is defined as &quot;the first live node&quot;. On the other hand %H value<br>
&gt; expected in follow_master_command is &quot;new primary node&quot;, which is not<br>
&gt; neccesary same as &quot;new master node&quot;.<br>
&gt;<br>
&gt; Attached patch should fix the problem(against 3.2-stable).<br>
&gt; --<br>
&gt; Tatsuo Ishii<br>
&gt; SRA OSS, Inc. Japan<br>
&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;<br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt; There is unexpected behavior in pgpool2 that seems to be a bug. Please find<br>
&gt;&gt; the details as following i.e.<br>
&gt;&gt;<br>
&gt;&gt; Phenomenon<br>
&gt;&gt;<br>
&gt;&gt;&gt; pgpool2 configuration option &quot;follow_master_command&quot; special character %H<br>
&gt;&gt;&gt; (Hostname of the new master node) is not working as expected<br>
&gt;&gt;&gt; In master slave mode after failover, 2nd node become new master but got<br>
&gt;&gt;&gt; unexpected hostname (via %H). Please find attached pgpool.conf for details.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Versions<br>
&gt;&gt;<br>
&gt;&gt;&gt; OS version: RHEL - 64<br>
&gt;&gt;&gt; pgpool version: pgpool-II version 3.2.1 (namameboshi)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; *Details/Observations* :-<br>
&gt;&gt;<br>
&gt;&gt;&gt; At Start<br>
&gt;&gt;<br>
&gt;&gt;&gt;  node_id | hostname | port | status | lb_weight |  role<br>
&gt;&gt;&gt; ---------+----------+------+--------+-----------+---------<br>
&gt;&gt;&gt;  0       | dmp02    | 5444 | 2      | 0.333333  | primary<br>
&gt;&gt;&gt;  1       | dmp03    | 5444 | 2      | 0.333333  | standby<br>
&gt;&gt;&gt;  2       | dmp04    | 5444 | 2      | 0.333333  | standby<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; Failover arguments when the user stopped DMP02.<br>
&gt;&gt;<br>
&gt;&gt;&gt; 2013îN 2åé 8ì˙ ã‡ójì˙ 12:44:12 JST<br>
&gt;&gt;<br>
&gt;&gt; FAILED_NODE_ID =0<br>
&gt;&gt;&gt; FAILED_NODE_NAME=dmp02<br>
&gt;&gt;&gt; FAILED_NODE_PORT=5444<br>
&gt;&gt;&gt; FAILED_NODE_DATA=/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; NEW_MASTER_ID =1<br>
&gt;&gt;&gt; OLD_MASTER_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_NAME =dmp03<br>
&gt;&gt;&gt; OLD_PRIMARY_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_DATA =/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; 0<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; Then, these arguments told user that the master node has been changed<br>
&gt;&gt;<br>
&gt;&gt;&gt; 2013îN 2åé 8ì˙ ã‡ójì˙ 12:44:13 JST<br>
&gt;&gt;&gt; FAILED_NODE_ID =0<br>
&gt;&gt;&gt; FAILED_NODE_NAME=dmp02<br>
&gt;&gt;&gt; FAILED_NODE_PORT=5444<br>
&gt;&gt;&gt; FAILED_NODE_DATA=/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; NEW_MASTER_ID =1<br>
&gt;&gt;&gt; OLD_MASTER_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_NAME =dmp03<br>
&gt;&gt;&gt; OLD_PRIMARY_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_DATA =/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; 2013îN 2åé 8ì˙ ã‡ójì˙ 12:44:17 JST<br>
&gt;&gt;&gt; FAILED_NODE_ID =2<br>
&gt;&gt;&gt; FAILED_NODE_NAME=dmp04<br>
&gt;&gt;&gt; FAILED_NODE_PORT=5444<br>
&gt;&gt;&gt; FAILED_NODE_DATA=/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; NEW_MASTER_ID =1<br>
&gt;&gt;&gt; OLD_MASTER_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_NAME =dmp02  *&lt;--- *** The master name is unexpected ****<br>
&gt;&gt;&gt; OLD_PRIMARY_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_DATA =/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt;  node_id | hostname | port | status | lb_weight |  role<br>
&gt;&gt;&gt; ---------+----------+------+--------+-----------+---------<br>
&gt;&gt;&gt;  0       | dmp02    | 5444 | 2      | 0.333333  | standby<br>
&gt;&gt;&gt;  1       | dmp03    | 5444 | 2      | 0.333333  | primary<br>
&gt;&gt;&gt;  2       | dmp04    | 5444 | 2      | 0.333333  | standby<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt;   pid  | usesysid |   usename    | application_name |  client_addr  |<br>
&gt;&gt;&gt; client_hostname | client_port |    backend_start                 |   state<br>
&gt;&gt;&gt;   | sent_location | write_location | flush_location | replay_location |<br>
&gt;&gt;&gt; sync_priority | sync_state<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; -------+----------+--------------+------------------+---------------+-----------------+-------------+----------------------------------+-----------+---------------+----------------+----------------+-----------------+---------------+------------<br>

&gt;&gt;&gt;  20641 |       10 | enterprisedb | dmp02            | 172.24.217.23 |<br>
&gt;&gt;&gt;             |       16948 | 08-FEB-13 17:39:44.078173 +09:00 | streaming |<br>
&gt;&gt;&gt; 14/C50000E0   | 14/C50000E0    | 14/C50000E0    | 14/C50000E0     |<br>
&gt;&gt;&gt;     0 | async<br>
&gt;&gt;&gt; (1 çs)<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; There is one pg_stat_replication record because dmp04 is connecting to dmp02<br>
&gt;&gt;<br>
&gt;&gt; This phenomenon is reproduced by user. What we need to do is just make the<br>
&gt;&gt; scripts like follow_master.sh and launch pgpool process with -F [path to<br>
&gt;&gt; pcp.conf].<br>
&gt;&gt;<br>
&gt;&gt; 1. Before failover<br>
&gt;&gt;<br>
&gt;&gt;&gt; -bash-3.2$ psql -h 10.1.1.187 -p 9999 -c &quot;show pool_nodes&quot;<br>
&gt;&gt;&gt; node_id | hostname | port | status | lb_weight | role<br>
&gt;&gt;&gt; ---------+----------+------+--------+-----------+---------<br>
&gt;&gt;&gt; 0 | slave1 | 5444 | 2 | 0.333333 | primary<br>
&gt;&gt;&gt; 1 | slave2 | 5444 | 2 | 0.333333 | standby<br>
&gt;&gt;&gt; 2 | slave3 | 5444 | 2 | 0.333333 | standby<br>
&gt;&gt;&gt; (3 行)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2. We stopped slave 1 node with &quot;pg_ctl -D /data -m immediate stop&quot;.<br>
&gt;&gt;<br>
&gt;&gt; 3. After failover<br>
&gt;&gt;<br>
&gt;&gt;&gt; -bash-3.2$ psql -h 10.1.1.187 -p 9999 -c &quot;show pool_nodes&quot;<br>
&gt;&gt;&gt; node_id | hostname | port | status | lb_weight | role<br>
&gt;&gt;&gt; ---------+----------+------+--------+-----------+---------<br>
&gt;&gt;&gt; 0 | slave1 | 5444 | 2 | 0.333333 | standby<br>
&gt;&gt;&gt; 1 | slave2 | 5444 | 2 | 0.333333 | primary<br>
&gt;&gt;&gt; 2 | slave3 | 5444 | 2 | 0.333333 | standby<br>
&gt;&gt;&gt; (3 行)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 4. Then user got output like below after failover that is not expected that<br>
&gt;&gt; is present at the end of follow_master.sh.log i.e.<br>
&gt;&gt;<br>
&gt;&gt;&gt; NEW_MASTER_NAME =slave1<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; [root@master1 ~]# cat /tmp/failover.sh.log<br>
&gt;&gt;<br>
&gt;&gt;&gt; 2013年 3月 13日 水曜日 11:36:28 JST<br>
&gt;&gt;&gt; FAILED_NODE_ID =0<br>
&gt;&gt;&gt; FAILED_NODE_NAME=slave1<br>
&gt;&gt;&gt; FAILED_NODE_PORT=5444<br>
&gt;&gt;&gt; FAILED_NODE_DATA=/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; NEW_MASTER_ID =1<br>
&gt;&gt;&gt; OLD_MASTER_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_NAME =slave2<br>
&gt;&gt;&gt; OLD_PRIMARY_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_DATA =/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; 0<br>
&gt;&gt;&gt;<br>
&gt;&gt; [root@master1 ~]# cat /tmp/follow_master.sh.log<br>
&gt;&gt;<br>
&gt;&gt;&gt; 2013年 3月 13日 水曜日 11:36:30 JST<br>
&gt;&gt;&gt; FAILED_NODE_ID =0<br>
&gt;&gt;&gt; FAILED_NODE_NAME=slave1<br>
&gt;&gt;&gt; FAILED_NODE_PORT=5444<br>
&gt;&gt;&gt; FAILED_NODE_DATA=/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; NEW_MASTER_ID =1<br>
&gt;&gt;&gt; OLD_MASTER_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_NAME =slave2<br>
&gt;&gt;&gt; OLD_PRIMARY_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_DATA =/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; 2013年 3月 13日 水曜日 11:36:32 JST<br>
&gt;&gt;&gt; FAILED_NODE_ID =2<br>
&gt;&gt;&gt; FAILED_NODE_NAME=slave3<br>
&gt;&gt;&gt; FAILED_NODE_PORT=5444<br>
&gt;&gt;&gt; FAILED_NODE_DATA=/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;&gt; NEW_MASTER_ID =1<br>
&gt;&gt;&gt; OLD_MASTER_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_NAME =*slave1<br>
&gt;&gt;&gt; *OLD_PRIMARY_ID =0<br>
&gt;&gt;&gt; NEW_MASTER_DATA =/opt/PostgresPlus/9.2AS/data<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Please guide. Thanks.<br>
&gt;&gt;<br>
&gt;&gt; Best Regards,<br>
&gt;&gt; Asif Naeem<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Ahsan Hadi<br>Snr Director Product Development<br>EnterpriseDB Corporation<br>The Enterprise Postgres Company<br><br>Phone: +92-51-8358874    <br>Mobile: +92-333-5162114<br>
<br>Website: <a href="http://www.enterprisedb.com">www.enterprisedb.com</a><br>EnterpriseDB Blog: <a href="http://blogs.enterprisedb.com/">http://blogs.enterprisedb.com/</a><br>Follow us on Twitter: <a href="http://www.twitter.com/enterprisedb">http://www.twitter.com/enterprisedb</a><br>
<br>This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.
</div></div>