<div dir="ltr">Hey all,<div><br></div><div>This is a seemingly a pretty bad problem which I uncovered as part of my last post, so the start of the message will be similar.</div><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">
I have two pgpool nodes which I am using a TCP load balancer to spread between. I am using watchdog to synchronise PostgreSQL node information between the two and an external HA solution (with ALLOW_TO_FAILOVER).</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">If I start both my pgpool nodes up I get the following initial state:<br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
<div>postgres=# show pool_nodes;</div><div> node_id |  hostname   | port | status | lb_weight |  role</div><div>---------+-------------+------+--------+-----------+---------</div><div> 0       | 10.10.10.1   | 5432 | 2      | 0.500000  | standby</div>
<div> 1       | 10.10.10.2   | 5432 | 2      | 0.500000  | primary</div><div>(2 rows)</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Now I open a PSQL connection and do the following:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>postgres=# SELECT inet_server_addr();</div>
<div> inet_server_addr</div><div>------------------</div><div> 10.10.10.2  </div><div>(1 row)</div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-size:small">This shows I am connected to the primary.</span></div>
<div style="font-family:arial,sans-serif;font-size:13px"><span style="font-size:small"><br></span></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-size:small">I can run this multiple times and I will always be connected to the primary, as long as I don&#39;t close the psql session.</span></div>
<div style="font-family:arial,sans-serif;font-size:13px"><span style="font-size:small"><br></span></div><div style="font-family:arial,sans-serif;font-size:13px">Then from another window I run the following command:<br></div>
<div style><font face="arial, sans-serif"><br></font></div><div style><span style="font-family:arial,sans-serif;font-size:13px"> pcp_detach_node 1 load_balancer 9898 postgres postgres 0</span><br></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">And in the same PSQL session run the command again:</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px"><div>postgres=# SELECT inet_server_addr();</div><div>SSL SYSCALL error: EOF detected</div><div>The connection to the server was lost. Attempting reset: Succeeded.</div>
<div><br></div><div>This is strange. Why has my master connection been severed?</div><div><br></div><div><span style="color:rgb(50,59,98);font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:bold">James Sewell,</span><br>
</div></span></div><div><div style="color:rgb(184,39,106);font-weight:bold;font-style:normal;font-variant:normal;font-size:14px;line-height:normal;font-family:Arial,Helvetica,sans-serif">
        <span style="color:rgb(169,169,169)"><span style="font-style:normal;font-variant:normal;font-weight:normal;font-size:12px;line-height:normal;font-family:Arial,Helvetica,sans-serif">PostgreSQL Team Lead / Solutions Architect </span></span><br>

        <span style="color:rgb(169,169,169)">______________________________________</span><br>
         </div>
<img alt="" src="http://www.lisasoft.com/sites/lisasoft/files/u1/logo1.jpg" style="margin: 0px; width: 153px; height: 50px;"><br>
<div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:12px;line-height:20px;font-family:Arial,Helvetica,sans-serif;color:rgb(64,64,64);margin:0px">
        <span style="color:rgb(169,169,169)">Level 2, 50 Queen St, Melbourne VIC 3000</span><br>
        <br>
        <strong>P </strong><span style="color:rgb(169,169,169)"><span style="font-family:Arial,Verdana,sans-serif">(+61) 3 8370 8000</span></span><span style="color:rgb(169,169,169)"> </span><strong> </strong><span style="color:rgb(50,59,98)"><span style="width:15px;display:inline-block"><strong>W</strong></span></span> <a style="color:rgb(64,64,64);margin:2px 0px;text-decoration:none"><span style="color:rgb(169,169,169)">www.lisasoft.com</span></a>  <span style="color:rgb(50,59,98)"><span style="width:15px;display:inline-block"><strong>F </strong></span></span><span style="color:rgb(169,169,169)"><span style="font-family:Arial,Verdana,sans-serif">(+61) 3 8370 8099</span></span></div>

<div style="padding-top:8px">
         </div></div>
</div></div>

<br>
<p><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:14.545454025268555px;background-color:rgb(255,255,255)"><hr><font size="1" color="Gray" face="Arial">The contents of this email are confidential and may be subject to legal or professional privilege and copyright. No representation is made that this email is free of viruses or other defects. If you have received this communication in error, you may not copy or distribute any part of it or otherwise disclose its contents to anyone. Please advise the sender of your incorrect receipt of this correspondence.</font></div></p>