<div dir="auto">Hi Bo, all,<div dir="auto"><br></div><div dir="auto">Thank you for your responses.</div><div dir="auto">Can you please confirm under what conditions the failover.sh script is executed? (Even though the script will be skipped if the node failing is non-primary)</div><div dir="auto"><br></div><div dir="auto">1. Is it executed every time when a node is down? </div><div dir="auto">(Because during this time, I am expecting the DB connection attempt will not work since failover is being executed)</div><div dir="auto"><br></div><div dir="auto">2. Also, in this state (Executing failover) what happens to the existing DB connections that were opened before failover event)</div><div dir="auto"><br></div><div dir="auto">Thanks again for your help,</div><div dir="auto">Gopi</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 23 Jun, 2023, 5:34 am Bo Peng, <<a href="mailto:pengbo@sraoss.co.jp">pengbo@sraoss.co.jp</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Sorry for the late reply.<br>
<br>
> Thanks for your response. To avoid hitting this error,<br>
> Is there a way to skip executing this failover since it is not the primary<br>
> node that failed?<br>
<br>
Unfortunately, there is currently no workaround.<br>
<br>
> I am using pgpool 4.0.4, Is this scenario enhanced in any later versions?<br>
<br>
Yes. We have plan to enhance this feature.<br>
<br>
> On Wed, Jun 14, 2023 at 9:34 AM Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank" rel="noreferrer">pengbo@sraoss.co.jp</a>> wrote:<br>
> <br>
> > Hi,<br>
> ><br>
> > > In my application, I see an error:<br>
> > ><br>
> > > Caused by: org.postgresql.util.PSQLException: FATAL: failed to create a<br>
> > > backend connection<br>
> > >   Detail: executing failover on backend<br>
> > > at<br>
> > ><br>
> > org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:514)<br>
> > > at<br>
> > ><br>
> > org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)<br>
> > > at<br>
> > ><br>
> > org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)<br>
> > ><br>
> > > Is there a configuration I can use to make the connection wait for the<br>
> > > failover to complete?<br>
> ><br>
> > Unfortunately, pgpool doesn't have such feature.<br>
> > You need to add such retry logic in your application code.<br>
> ><br>
> > > Also, I can see that the failover was not indeed a failover, i.e the<br>
> > > failover would eventually<br>
> > > be skipped since it is not the primary node that failed:<br>
> > ><br>
> > > 2023-06-12_18:27:55 [failover.sh]: failed_node_id=1<br>
> > failed_host=10.198.49.42<br>
> > > 2023-06-12_18:27:55 [failover.sh]: old_master_node_id=0<br>
> > > old_primary_node_id=0<br>
> > > 2023-06-12_18:27:55 [failover.sh]: new_primary_node_id=0<br>
> > > new_master_host=10.198.49.41<br>
> > > 2023-06-12_18:27:55 [failover.sh]: Node 1 dies, but it's not the primary<br>
> > > node. Skipping failover.<br>
> ><br>
> > Yes. Pgpool-II checks the role of the failed node in the failover script.<br>
> > If the failed node is a standby node, pgpool just updates<br>
> > the node status to DOWN and skips failover.<br>
> ><br>
> > --<br>
> > Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank" rel="noreferrer">pengbo@sraoss.co.jp</a>><br>
> > SRA OSS LLC<br>
> > TEL: 03-5979-2701 FAX: 03-5979-2702<br>
> > URL: <a href="https://www.sraoss.co.jp/" rel="noreferrer noreferrer" target="_blank">https://www.sraoss.co.jp/</a><br>
> ><br>
<br>
<br>
-- <br>
Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank" rel="noreferrer">pengbo@sraoss.co.jp</a>><br>
SRA OSS LLC<br>
TEL: 03-5979-2701 FAX: 03-5979-2702<br>
URL: <a href="https://www.sraoss.co.jp/" rel="noreferrer noreferrer" target="_blank">https://www.sraoss.co.jp/</a><br>
</blockquote></div>