2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-23 01:53:28 +00:00

Add a failsafe for errors trying to connect to a new leader

Provide better experience in the face of the class of errors such
as the one fixed by previous commit.
This commit is contained in:
Jarrod Johnson 2021-09-30 08:18:39 -04:00
parent c1113430a2
commit c93917e4a4

View File

@ -184,8 +184,12 @@ def follow_leader(remote, leader):
if newleader:
log.log(
{'info': 'Previous leader directed us to join new leader {}'.format(newleader)})
if connect_to_leader(None, get_myname(), newleader):
return
try:
if connect_to_leader(None, get_myname(), newleader):
return
except Exception:
log.log({'error': 'Unknown error attempting to connect to {}, check trace log'.format(newleader), 'subsystem': 'collective'})
cfm.logException()
log.log({'info': 'Current leader ({0}) has disappeared, restarting '
'collective membership'.format(leader), 'subsystem': 'collective'})
# The leader has folded, time to startup again...