<div dir="ltr">It will be great to get this fix committed.<div><br></div><div>Are you planning to back port this fix?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 4, 2016 at 12:27 PM, Muhammad Usama <span dir="ltr">&lt;<a href="mailto:m.usama@gmail.com" target="_blank">m.usama@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, May 4, 2016 at 5:53 AM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Usama,<br>
<br>
Thank you for testing the patch. Shall I commit/push it after you fix<br>
the regression test issue? Or shall I commit/push it now? Either is<br>
fine for me.<br></blockquote><div><br></div></span><div style="font-size:12.8px"><br>I have already pushed the fix for regression failure, and was waiting for the buildfarm results for the confirmation.  Todays results verified the fix, and you can go ahead with committing the patch.</div><div style="font-size:12.8px"><br></div><div><span style="font-size:12.8px">Kind regards</span></div><span class="HOEnZb"><font color="#888888"><div>Muhammad Usama </div></font></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Best regards,<br>
<div><div>--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; Hi Ishii-San<br>
&gt;<br>
&gt; I have tested the patch, It successfully takes care of the very annoying<br>
&gt; problem and it is working as expected.<br>
&gt;<br>
&gt; Best regards<br>
&gt; Muhammad Usama<br>
&gt;<br>
&gt;<br>
&gt; On Tue, May 3, 2016 at 5:25 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Currently any attempt to connect to pgpool fails if pgpool is doing<br>
&gt;&gt; health check against failed node even if fail_over_on_backend_error is<br>
&gt;&gt; off because pgpool child first tries to connect to all backend<br>
&gt;&gt; including the failed one and exits if it fails to connect to a backend<br>
&gt;&gt; (of course it fails). This is a temporary situation and will be<br>
&gt;&gt; resolved before pgpool executes failover. However if the health check<br>
&gt;&gt; is retrying, the temporary situation keeps longer depending on the<br>
&gt;&gt; setting of health_check_max_retries and health_check_retry_delay. This<br>
&gt;&gt; is not good. Attached patch tries to mitigate the problem:<br>
&gt;&gt;<br>
&gt;&gt; - When an attempt to connect to backend fails, give up connecting to<br>
&gt;&gt;   the failed node and skip to other node, rather than exiting the<br>
&gt;&gt;   process if operating in streaming replication mode and the node is<br>
&gt;&gt;   not primary node.<br>
&gt;&gt;<br>
&gt;&gt; - Mark the local status of the failed node to &quot;down&quot;.<br>
&gt;&gt;<br>
&gt;&gt; - This will let the primary node be selected as a load balance node<br>
&gt;&gt;   and every queries will be sent to the primary node. If there&#39;s other<br>
&gt;&gt;   healthy standby nodes, one of them will be chosen as the load<br>
&gt;&gt;   balance node.<br>
&gt;&gt;<br>
&gt;&gt; - After the session is over, the child process will suicide to not<br>
&gt;&gt;   retain the local status.<br>
&gt;&gt;<br>
&gt;&gt; Comments?<br>
&gt;&gt; --<br>
&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;<br>
&gt;&gt; diff --git a/src/include/pool.h b/src/include/pool.h<br>
&gt;&gt; index 4c6e82f..1f43efd 100644<br>
&gt;&gt; --- a/src/include/pool.h<br>
&gt;&gt; +++ b/src/include/pool.h<br>
&gt;&gt; @@ -323,6 +323,7 @@ extern int my_master_node_id;<br>
&gt;&gt;   */<br>
&gt;&gt;  #define PRIMARY_NODE_ID (Req_info-&gt;primary_node_id &gt;=0?\<br>
&gt;&gt;<br>
&gt;&gt;  Req_info-&gt;primary_node_id:REAL_MASTER_NODE_ID)<br>
&gt;&gt; +#define IS_PRIMARY_NODE_ID(node_id)    (node_id == PRIMARY_NODE_ID)<br>
&gt;&gt;<br>
&gt;&gt;  /*<br>
&gt;&gt;   * Real primary node id. If not in the mode or there&#39;s no primary<br>
&gt;&gt; diff --git a/src/protocol/pool_connection_pool.c<br>
&gt;&gt; b/src/protocol/pool_connection_pool.c<br>
&gt;&gt; index b7cc946..7c33366 100644<br>
&gt;&gt; --- a/src/protocol/pool_connection_pool.c<br>
&gt;&gt; +++ b/src/protocol/pool_connection_pool.c<br>
&gt;&gt; @@ -812,8 +812,8 @@ static POOL_CONNECTION_POOL_SLOT<br>
&gt;&gt; *create_cp(POOL_CONNECTION_POOL_SLOT *cp, int s<br>
&gt;&gt;  }<br>
&gt;&gt;<br>
&gt;&gt;  /*<br>
&gt;&gt; - * create actual connections to backends<br>
&gt;&gt; - * new connection resides in TopMemoryContext<br>
&gt;&gt; + * Create actual connections to backends.<br>
&gt;&gt; + * New connection resides in TopMemoryContext.<br>
&gt;&gt;   */<br>
&gt;&gt;  static POOL_CONNECTION_POOL *new_connection(POOL_CONNECTION_POOL *p)<br>
&gt;&gt;  {<br>
&gt;&gt; @@ -851,12 +851,34 @@ static POOL_CONNECTION_POOL<br>
&gt;&gt; *new_connection(POOL_CONNECTION_POOL *p)<br>
&gt;&gt;                                 ereport(FATAL,<br>
&gt;&gt;                                         (errmsg(&quot;failed to create a<br>
&gt;&gt; backend connection&quot;),<br>
&gt;&gt;                                                  errdetail(&quot;executing<br>
&gt;&gt; failover on backend&quot;)));<br>
&gt;&gt; -                       }<br>
&gt;&gt; +                       }<br>
&gt;&gt;                         else<br>
&gt;&gt;                         {<br>
&gt;&gt; -                               ereport(FATAL,<br>
&gt;&gt; -                                       (errmsg(&quot;failed to create a<br>
&gt;&gt; backend connection&quot;),<br>
&gt;&gt; -                                                errdetail(&quot;not executing<br>
&gt;&gt; failover because fail_over_on_backend_error is off&quot;)));<br>
&gt;&gt; +                               /*<br>
&gt;&gt; +                                * If we are in streaming replication mode<br>
&gt;&gt; and the node is a<br>
&gt;&gt; +                                * standby node, then we skip this node to<br>
&gt;&gt; avoid fail over.<br>
&gt;&gt; +                                */<br>
&gt;&gt; +                               if (STREAM &amp;&amp; !IS_PRIMARY_NODE_ID(i))<br>
&gt;&gt; +                               {<br>
&gt;&gt; +                                       ereport(LOG,<br>
&gt;&gt; +                                                       (errmsg(&quot;failed to<br>
&gt;&gt; create a backend %d connection&quot;, i),<br>
&gt;&gt; +                                                        errdetail(&quot;skip<br>
&gt;&gt; this backend because because fail_over_on_backend_error is off and we are<br>
&gt;&gt; in streaming replication mode and node is standby node&quot;)));<br>
&gt;&gt; +<br>
&gt;&gt; +                                       /* set down status to local status<br>
&gt;&gt; area */<br>
&gt;&gt; +                                       *(my_backend_status[i]) = CON_DOWN;<br>
&gt;&gt; +<br>
&gt;&gt; +                                       /* make sure that we need to<br>
&gt;&gt; restart the process after<br>
&gt;&gt; +                                        * finishing this session<br>
&gt;&gt; +                                        */<br>
&gt;&gt; +<br>
&gt;&gt;  pool_get_my_process_info()-&gt;need_to_restart = 1;<br>
&gt;&gt; +                                       continue;<br>
&gt;&gt; +                               }<br>
&gt;&gt; +                               else<br>
&gt;&gt; +                               {<br>
&gt;&gt; +                                       ereport(FATAL,<br>
&gt;&gt; +                                                       (errmsg(&quot;failed to<br>
&gt;&gt; create a backend %d connection&quot;, i),<br>
&gt;&gt; +                                                        errdetail(&quot;not<br>
&gt;&gt; executing failover because fail_over_on_backend_error is off&quot;)));<br>
&gt;&gt; +                               }<br>
&gt;&gt;                         }<br>
&gt;&gt;                         child_exit(POOL_EXIT_AND_RESTART);<br>
&gt;&gt;                 }<br>
&gt;&gt; diff --git a/src/utils/pool_process_reporting.c<br>
&gt;&gt; b/src/utils/pool_process_reporting.c<br>
&gt;&gt; index 9b190c7..6cfd860 100644<br>
&gt;&gt; --- a/src/utils/pool_process_reporting.c<br>
&gt;&gt; +++ b/src/utils/pool_process_reporting.c<br>
&gt;&gt; @@ -5,7 +5,7 @@<br>
&gt;&gt;   * pgpool: a language independent connection pool server for PostgreSQL<br>
&gt;&gt;   * written by Tatsuo Ishii<br>
&gt;&gt;   *<br>
&gt;&gt; - * Copyright (c) 2003-2015     PgPool Global Development Group<br>
&gt;&gt; + * Copyright (c) 2003-2016     PgPool Global Development Group<br>
&gt;&gt;   *<br>
&gt;&gt;   * Permission to use, copy, modify, and distribute this software and<br>
&gt;&gt;   * its documentation for any purpose and without fee is hereby<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; pgpool-hackers mailing list<br>
&gt;&gt; <a href="mailto:pgpool-hackers@pgpool.net" target="_blank">pgpool-hackers@pgpool.net</a><br>
&gt;&gt; <a href="http://www.pgpool.net/mailman/listinfo/pgpool-hackers" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-hackers</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
</div></div></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
pgpool-hackers mailing list<br>
<a href="mailto:pgpool-hackers@pgpool.net">pgpool-hackers@pgpool.net</a><br>
<a href="http://www.pgpool.net/mailman/listinfo/pgpool-hackers" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-hackers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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" target="_blank">www.enterprisedb.com</a><br>EnterpriseDB Blog: <a href="http://blogs.enterprisedb.com/" target="_blank">http://blogs.enterprisedb.com/</a><br>Follow us on Twitter: <a href="http://www.twitter.com/enterprisedb" target="_blank">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>