<div dir="ltr"><div>Hi Ishii-San</div><div><br></div><div>:-) Thanks for the confirmation.</div><div><br></div><div>Best Regards</div><div>Muhammad Usama</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 8, 2019 at 1:28 PM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>&gt; 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">Oops. I should have connected to the master Pgpool-II:<br>
<br>
t-ishii$ psql -p 50004 -c &quot;show pool_nodes&quot; test<br>
 node_id | hostname | port  | status | lb_weight |  role   | select_cnt | load_balance_node | replication_delay | replication_state | replication_sync_state | last_status_change  <br>
---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------+-------------------+------------------------+---------------------<br>
 0       | /tmp     | 51000 | up     | 0.333333  | primary | 0          | true              | 0                 |                   |                        | 2019-08-08 17:26:27<br>
 1       | /tmp     | 51001 | up     | 0.333333  | standby | 0          | false             | 0                 | streaming         | async                  | 2019-08-08 17:26:27<br>
 2       | /tmp     | 51002 | up     | 0.333333  | standby | 0          | false             | 0                 | streaming         | async                  | 2019-08-08 17:26:27<br>
(3 rows)<br>
<br>
Now node 0 is primary, works great as I expected.<br>
Sorry for confusion.<br>
<br>
&gt; Hi Usama,<br>
&gt; <br>
&gt; Thanks for the commit. Unfortunately the fix did not work for me.<br>
&gt; <br>
&gt; psql -p 50000 -c &quot;show pool_nodes&quot; test<br>
&gt;  node_id | hostname | port  |   status   | lb_weight |  role   | select_cnt | load_balance_node | replication_delay | replication_state | replication_sync_state | last_status_change  <br>
&gt; ---------+----------+-------+------------+-----------+---------+------------+-------------------+-------------------+-------------------+------------------------+---------------------<br>
&gt;  0       | /tmp     | 51000 | quarantine | 0.333333  | standby | 0          | false             | 0                 |                   |                        | 2019-08-08 17:09:17<br>
&gt;  1       | /tmp     | 51001 | up         | 0.333333  | standby | 0          | false             | 0                 |                   |                        | 2019-08-08 17:09:00<br>
&gt;  2       | /tmp     | 51002 | up         | 0.333333  | standby | 0          | true              | 0                 |                   |                        | 2019-08-08 17:09:00<br>
&gt; (3 rows)<br>
&gt; <br>
&gt; There&#39;s no primary PostgreSQL node after node was quarantined.<br>
&gt; Pgpool log attached.<br>
&gt; <br>
&gt; From: Muhammad Usama &lt;<a href="mailto:m.usama@gmail.com" target="_blank">m.usama@gmail.com</a>&gt;<br>
&gt; Subject: Re: Behavior of resigned master watchdog node<br>
&gt; Date: Thu, 8 Aug 2019 11:21:24 +0500<br>
&gt; Message-ID: &lt;CAEJvTzUpYZHc=T8FvOB12N=<a href="mailto:gC_Qj961dZEpRZTggsLHz_gJqSQ@mail.gmail.com" target="_blank">gC_Qj961dZEpRZTggsLHz_gJqSQ@mail.gmail.com</a>&gt;<br>
&gt; <br>
&gt;&gt; Hi Ishii-San<br>
&gt;&gt; <br>
&gt;&gt; Thanks for providing the log files along with the steps to reproduce the<br>
&gt;&gt; issue. I have pushed the fix for it<br>
&gt;&gt; <br>
&gt;&gt; <a href="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commitdiff;h=2d7702c6961e8949e97992c23a42c8616af36d84" rel="noreferrer" target="_blank">https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commitdiff;h=2d7702c6961e8949e97992c23a42c8616af36d84</a><br>
&gt;&gt; <br>
&gt;&gt; Thanks<br>
&gt;&gt; Best Regards<br>
&gt;&gt; Muhammad Usama<br>
&gt;&gt; <br>
&gt;&gt; <br>
&gt;&gt; On Fri, Aug 2, 2019 at 4:50 PM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>&gt; wrote:<br>
&gt;&gt; <br>
&gt;&gt;&gt; &gt; Hi Ishii-San<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; On Fri, Aug 2, 2019 at 10:25 AM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>&gt; wrote:<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; Hi Usama,<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; In your commit:<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; <a href="https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=33df0d33df1ce701f07fecaeef5b87a2707c08f2" rel="noreferrer" target="_blank">https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=33df0d33df1ce701f07fecaeef5b87a2707c08f2</a><br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &quot;the master watchdog node should resign from master responsibilities<br>
&gt;&gt;&gt; &gt;&gt; if the primary backend node gets into quarantine state on that.&quot;<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; While testing this feature, I noticed that the master watchdog node<br>
&gt;&gt;&gt; &gt;&gt; resign from master responsibilities as expected in this case. However<br>
&gt;&gt;&gt; &gt;&gt; none of standby nodes gets promoted to new primary. As a result,<br>
&gt;&gt;&gt; &gt;&gt; there&#39;s no primary node any more after the master watchdog resign.<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; This is not very good because users cannot<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; This is not at all expected behavior, Can you please share the logs or<br>
&gt;&gt;&gt; &gt; steps to reproduce the issue.<br>
&gt;&gt;&gt; &gt; I will look into this on priority.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sure. Pgpool.logs attached.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Here are steps to reproduce the issue.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; - Pgpool-II master branch head with patch [pgpool-hackers: 3361].<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 1) create 3 watchdog/3 PostgreSQL cluster: watchdog_setup -wn 3 -n 3<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; $ psql -p 50000 -c &quot;show pool_nodes&quot; test<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;  node_id | hostname | port  | status | lb_weight |  role   | select_cnt |<br>
&gt;&gt;&gt; load_balance_node | replication_delay | replication_state |<br>
&gt;&gt;&gt; replication_sync_state | last_status_change<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------+-------------------+------------------------+---------------------<br>
&gt;&gt;&gt;  0       | /tmp     | 51000 | up     | 0.333333  | primary | 0          |<br>
&gt;&gt;&gt; true              | 0                 |                   |<br>
&gt;&gt;&gt;         | 2019-08-02 20:38:25<br>
&gt;&gt;&gt;  1       | /tmp     | 51001 | up     | 0.333333  | standby | 0          |<br>
&gt;&gt;&gt; false             | 0                 | streaming         | async<br>
&gt;&gt;&gt;         | 2019-08-02 20:38:25<br>
&gt;&gt;&gt;  2       | /tmp     | 51002 | up     | 0.333333  | standby | 0          |<br>
&gt;&gt;&gt; false             | 0                 | streaming         | async<br>
&gt;&gt;&gt;         | 2019-08-02 20:38:25<br>
&gt;&gt;&gt; (3 rows)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; $ pcp_watchdog_info -p 50001 -v -w<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Watchdog Cluster Information<br>
&gt;&gt;&gt; Total Nodes          : 3<br>
&gt;&gt;&gt; Remote Nodes         : 2<br>
&gt;&gt;&gt; Quorum state         : QUORUM EXIST<br>
&gt;&gt;&gt; Alive Remote Nodes   : 2<br>
&gt;&gt;&gt; VIP up on local node : YES<br>
&gt;&gt;&gt; Master Node Name     : localhost:50000 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Master Host Name     : localhost<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Watchdog Node Information<br>
&gt;&gt;&gt; Node Name      : localhost:50000 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Host Name      : localhost<br>
&gt;&gt;&gt; Delegate IP    : Not_Set<br>
&gt;&gt;&gt; Pgpool port    : 50000<br>
&gt;&gt;&gt; Watchdog port  : 50002<br>
&gt;&gt;&gt; Node priority  : 3<br>
&gt;&gt;&gt; Status         : 4<br>
&gt;&gt;&gt; Status Name    : MASTER<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Node Name      : localhost:50004 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Host Name      : localhost<br>
&gt;&gt;&gt; Delegate IP    : Not_Set<br>
&gt;&gt;&gt; Pgpool port    : 50004<br>
&gt;&gt;&gt; Watchdog port  : 50006<br>
&gt;&gt;&gt; Node priority  : 2<br>
&gt;&gt;&gt; Status         : 7<br>
&gt;&gt;&gt; Status Name    : STANDBY<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Node Name      : localhost:50008 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Host Name      : localhost<br>
&gt;&gt;&gt; Delegate IP    : Not_Set<br>
&gt;&gt;&gt; Pgpool port    : 50008<br>
&gt;&gt;&gt; Watchdog port  : 50010<br>
&gt;&gt;&gt; Node priority  : 1<br>
&gt;&gt;&gt; Status         : 7<br>
&gt;&gt;&gt; Status Name    : STANDBY<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2) echo &quot;0      down&quot; &gt; pgpoo0/log<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 3) check the result.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; $psql -p 50000 -c &quot;show pool_nodes&quot; test<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;  node_id | hostname | port  | status | lb_weight |  role   | select_cnt |<br>
&gt;&gt;&gt; load_balance_node | replication_delay | replication_state |<br>
&gt;&gt;&gt; replication_sync_state | last_status_change<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ---------+----------+-------+--------+-----------+---------+------------+-------------------+-------------------+-------------------+------------------------+---------------------<br>
&gt;&gt;&gt;  0       | /tmp     | 51000 | up     | 0.333333  | standby | 0          |<br>
&gt;&gt;&gt; true              | 0                 |                   |<br>
&gt;&gt;&gt;         | 2019-08-02 20:39:25<br>
&gt;&gt;&gt;  1       | /tmp     | 51001 | up     | 0.333333  | standby | 0          |<br>
&gt;&gt;&gt; false             | 0                 |                   |<br>
&gt;&gt;&gt;         | 2019-08-02 20:39:25<br>
&gt;&gt;&gt;  2       | /tmp     | 51002 | up     | 0.333333  | standby | 0          |<br>
&gt;&gt;&gt; false             | 0                 |                   |<br>
&gt;&gt;&gt;         | 2019-08-02 20:39:25<br>
&gt;&gt;&gt; (3 rows)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; $ pcp_watchdog_info -p 50001 -v -w<br>
&gt;&gt;&gt; Watchdog Cluster Information<br>
&gt;&gt;&gt; Total Nodes          : 3<br>
&gt;&gt;&gt; Remote Nodes         : 2<br>
&gt;&gt;&gt; Quorum state         : QUORUM EXIST<br>
&gt;&gt;&gt; Alive Remote Nodes   : 2<br>
&gt;&gt;&gt; VIP up on local node : NO<br>
&gt;&gt;&gt; Master Node Name     : localhost:50004 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Master Host Name     : localhost<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Watchdog Node Information<br>
&gt;&gt;&gt; Node Name      : localhost:50000 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Host Name      : localhost<br>
&gt;&gt;&gt; Delegate IP    : Not_Set<br>
&gt;&gt;&gt; Pgpool port    : 50000<br>
&gt;&gt;&gt; Watchdog port  : 50002<br>
&gt;&gt;&gt; Node priority  : 3<br>
&gt;&gt;&gt; Status         : 7<br>
&gt;&gt;&gt; Status Name    : STANDBY<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Node Name      : localhost:50004 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Host Name      : localhost<br>
&gt;&gt;&gt; Delegate IP    : Not_Set<br>
&gt;&gt;&gt; Pgpool port    : 50004<br>
&gt;&gt;&gt; Watchdog port  : 50006<br>
&gt;&gt;&gt; Node priority  : 2<br>
&gt;&gt;&gt; Status         : 4<br>
&gt;&gt;&gt; Status Name    : MASTER<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Node Name      : localhost:50008 Linux tishii-CFSV7-1<br>
&gt;&gt;&gt; Host Name      : localhost<br>
&gt;&gt;&gt; Delegate IP    : Not_Set<br>
&gt;&gt;&gt; Pgpool port    : 50008<br>
&gt;&gt;&gt; Watchdog port  : 50010<br>
&gt;&gt;&gt; Node priority  : 1<br>
&gt;&gt;&gt; Status         : 7<br>
&gt;&gt;&gt; Status Name    : STANDBY<br>
&gt;&gt;&gt;<br>
</blockquote></div></div>