[pgpool-general: 8874] Re: DB Connection ERROR during a failover

Gopikrishnan nksgopikrishnan at gmail.com
Thu Jul 6 23:21:28 JST 2023


Hi all,

Any info. would be much appreciated.
My questions are:

1. Is *failover.sh *executed everytime any node goes down?
2. When such a *failover *event is triggered, what happens to all the
connections opened against all the nodes?

*Thanks*
*Gopi*


On Thu, Jun 29, 2023 at 2:04 PM Gopikrishnan <nksgopikrishnan at gmail.com>
wrote:

> Hi Bo, all,
>
> Thank you for your responses.
> 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)
>
> 1. Is it executed every time when a node is down?
> (Because during this time, I am expecting the DB connection attempt will
> not work since failover is being executed)
>
> 2. Also, in this state (Executing failover) what happens to the existing
> DB connections that were opened before failover event)
>
> Thanks again for your help,
> Gopi
>
> On Fri, 23 Jun, 2023, 5:34 am Bo Peng, <pengbo at sraoss.co.jp> wrote:
>
>> Hi,
>>
>> Sorry for the late reply.
>>
>> > Thanks for your response. To avoid hitting this error,
>> > Is there a way to skip executing this failover since it is not the
>> primary
>> > node that failed?
>>
>> Unfortunately, there is currently no workaround.
>>
>> > I am using pgpool 4.0.4, Is this scenario enhanced in any later
>> versions?
>>
>> Yes. We have plan to enhance this feature.
>>
>> > On Wed, Jun 14, 2023 at 9:34 AM Bo Peng <pengbo at sraoss.co.jp> wrote:
>> >
>> > > Hi,
>> > >
>> > > > In my application, I see an error:
>> > > >
>> > > > Caused by: org.postgresql.util.PSQLException: FATAL: failed to
>> create a
>> > > > backend connection
>> > > >   Detail: executing failover on backend
>> > > > at
>> > > >
>> > >
>> org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:514)
>> > > > at
>> > > >
>> > >
>> org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
>> > > > at
>> > > >
>> > >
>> org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
>> > > >
>> > > > Is there a configuration I can use to make the connection wait for
>> the
>> > > > failover to complete?
>> > >
>> > > Unfortunately, pgpool doesn't have such feature.
>> > > You need to add such retry logic in your application code.
>> > >
>> > > > Also, I can see that the failover was not indeed a failover, i.e the
>> > > > failover would eventually
>> > > > be skipped since it is not the primary node that failed:
>> > > >
>> > > > 2023-06-12_18:27:55 [failover.sh]: failed_node_id=1
>> > > failed_host=10.198.49.42
>> > > > 2023-06-12_18:27:55 [failover.sh]: old_master_node_id=0
>> > > > old_primary_node_id=0
>> > > > 2023-06-12_18:27:55 [failover.sh]: new_primary_node_id=0
>> > > > new_master_host=10.198.49.41
>> > > > 2023-06-12_18:27:55 [failover.sh]: Node 1 dies, but it's not the
>> primary
>> > > > node. Skipping failover.
>> > >
>> > > Yes. Pgpool-II checks the role of the failed node in the failover
>> script.
>> > > If the failed node is a standby node, pgpool just updates
>> > > the node status to DOWN and skips failover.
>> > >
>> > > --
>> > > Bo Peng <pengbo at sraoss.co.jp>
>> > > SRA OSS LLC
>> > > TEL: 03-5979-2701 FAX: 03-5979-2702
>> > > URL: https://www.sraoss.co.jp/
>> > >
>>
>>
>> --
>> Bo Peng <pengbo at sraoss.co.jp>
>> SRA OSS LLC
>> TEL: 03-5979-2701 FAX: 03-5979-2702
>> URL: https://www.sraoss.co.jp/
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20230706/e5260274/attachment.htm>


More information about the pgpool-general mailing list