<div dir="ltr">Hello Bo.<div>Thank you for your answer.</div><div><br></div><div>I have checked these steps but attaching node1 (<span style="font-size:12.8px">after failover without recovery) </span>instead of node 0, and I can&#39;t reproduce this situation with node 1. Do you know if this behaviour is by desing of Pgpool? Why is it necessary to use <span style="font-size:12.8px">pcp_recovery_node</span><span style="font-size:12.8px">  instead of pcp_attach_node?</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Kind regards.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 21, 2017 at 1:30 AM, Bo Peng <span dir="ltr">&lt;<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@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">Hello,<br>
<br>
If you want to start node0 (old primary) as standby,<br>
you should use pcp_recovery_node to recovery node0 as standby.<br>
<br>
If you just restart node0 after failover without recovery,<br>
it will run as primary.<br>
<br>
On Fri, 20 Oct 2017 18:41:36 +0200<br>
Lucas Luengas &lt;<a href="mailto:lucasluengas@gmail.com">lucasluengas@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hello<br>
&gt; I am testing Pgpool 3.4.13 with Postgresql-9.6, with streaming replication<br>
&gt; and watchdog, on Centos 7. I have two server. Every server has installed<br>
&gt; Pgpool and Postgresql. I have installed pgpool from yum repository.<br>
&gt;<br>
&gt; Node 0 is primary, with status 2<br>
&gt; Node 1 is standby, with status 2<br>
&gt;<br>
&gt; If Postgresql service is stopped in node 0, then:<br>
&gt; node 0 is standby, with status 3<br>
&gt; node 1 is primary, with status 2. (failover)<br>
&gt;<br>
&gt; Then, Postgresql service is started in node 0.<br>
&gt; node 0 is standby, with status 3<br>
&gt; node 1 is primary, with status 2<br>
&gt;<br>
&gt; Then, I attach node 0 using pcp_attach_node command.<br>
&gt; node 0 is primary, with status 2.<br>
&gt; node 1 is standby, with status 2.<br>
&gt; Node 0 was changed to primary and node 1 was changed to standby. Why ? Do I<br>
&gt; have any error in my setup?<br>
&gt; I think the correct result should be:<br>
&gt; node 0 is standby, with status 2<br>
&gt; node 1 is primary, with status 2<br>
&gt;<br>
&gt; I have repeated previous steps with pgpool 3.4.12, 3,4.11, 3.4.10 and 3.4.9<br>
&gt; with same configuration and same server. I get same results.<br>
&gt; Also, I have repeated step with pgpool 3.6.6 and I get same results.<br>
&gt;<br>
&gt; Some log lines during fallback<br>
&gt;<br>
&gt; Oct 20 13:41:03 localhost pgpool[9687]: [128-1] 2017-10-20 13:41:03: pid<br>
&gt; 9687: LOG:  received failback request for node_id: 0 from pid [9687]<br>
&gt; Oct 20 13:41:03 localhost pgpool[4913]: [255-1] 2017-10-20 13:41:03: pid<br>
&gt; 4913: LOG:  watchdog notifying to start interlocking<br>
&gt; Oct 20 13:41:03 localhost pgpool[4913]: [256-1] 2017-10-20 13:41:03: pid<br>
&gt; 4913: LOG:  starting fail back. reconnect host 192.168.0.136(5432)<br>
&gt; Oct 20 13:41:03 localhost pgpool[4913]: [257-1] 2017-10-20 13:41:03: pid<br>
&gt; 4913: LOG:  Node 1 is not down (status: 2)<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [258-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  Do not restart children because we are failbacking node id 0<br>
&gt; host: 192.168.0.136 port: 5432 and we are in streaming replication mode and<br>
&gt; not all backends were down<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [259-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  find_primary_node_repeatedly: waiting for finding a primary node<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [260-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  find_primary_node: checking backend no 0<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [260-2]<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [261-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  find_primary_node: primary node id is 0<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [262-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  watchdog notifying to end interlocking<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [263-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  failover: set new primary node: 0<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [264-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  failover: set new master node: 0<br>
&gt; Oct 20 13:41:04 localhost pgpool[4913]: [265-1] 2017-10-20 13:41:04: pid<br>
&gt; 4913: LOG:  failback done. reconnect host 192.168.0.136(5432)<br>
&gt; Oct 20 13:41:04 localhost pgpool[9688]: [194-1] 2017-10-20 13:41:04: pid<br>
&gt; 9688: LOG:  worker process received restart request<br>
&gt; Oct 20 13:41:05 localhost pgpool[9687]: [129-1] 2017-10-20 13:41:05: pid<br>
&gt; 9687: LOG:  restart request received in pcp child process<br>
&gt; Oct 20 13:41:05 localhost pgpool[4913]: [266-1] 2017-10-20 13:41:05: pid<br>
&gt; 4913: LOG:  PCP child 9687 exits with status 256 in failover()<br>
&gt; Oct 20 13:41:05 localhost pgpool[4913]: [267-1] 2017-10-20 13:41:05: pid<br>
&gt; 4913: LOG:  fork a new PCP child pid 10410 in failover()<br>
&gt; Oct 20 13:41:05 localhost pgpool[4913]: [268-1] 2017-10-20 13:41:05: pid<br>
&gt; 4913: LOG:  worker child process with pid: 9688 exits with status 256<br>
&gt; Oct 20 13:41:05 localhost pgpool[4913]: [269-1] 2017-10-20 13:41:05: pid<br>
&gt; 4913: LOG:  fork a new worker child process with pid: 10411<br>
&gt; Oct 20 13:41:10 localhost pgpool[9692]: [202-1] 2017-10-20 13:41:10: pid<br>
&gt; 9692: LOG:  selecting backend connection<br>
&gt; Oct 20 13:41:10 localhost pgpool[9692]: [202-2] 2017-10-20 13:41:10: pid<br>
&gt; 9692: DETAIL:  failback event detected, discarding existing connections<br>
&gt;<br>
&gt; Kind regards<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Bo Peng &lt;<a href="mailto:pengbo@sraoss.co.jp">pengbo@sraoss.co.jp</a>&gt;<br>
SRA OSS, Inc. Japan<br>
<br>
</font></span></blockquote></div><br></div>