2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 17:43:14 +00:00

Add logging to the assimilation phase of collective

When attempting assimilation, provide logging about the attempt.
This commit is contained in:
Jarrod Johnson 2018-09-27 10:38:00 -04:00
parent a3b0b0240d
commit 0724ad812b

View File

@ -18,6 +18,7 @@ import base64
import confluent.collective.invites as invites
import confluent.config.configmanager as cfm
import confluent.exceptions as exc
import confluent.log as log
import confluent.tlvdata as tlvdata
import confluent.util as util
import eventlet
@ -437,8 +438,24 @@ def try_assimilate(drone):
tlvdata.recv(remote) # the banner
tlvdata.recv(remote) # authpassed... 0..
answer = tlvdata.recv(remote)
if answer and 'txcount' in answer:
if not answer:
log.log(
{'error':
'No answer from {0} while trying to assimilate'.format(
drone)})
return
if 'txcount' in answer:
log.log({'info': 'Deferring to {0} due to transaction count'.format(
drone)})
connect_to_leader(None, None, leader=remote.getpeername()[0])
return
if 'error' in answer:
log.log({
'error': 'Error encountered while attempting to '
'assimilate {0}: {1}'.format(drone, answer['error'])})
return
log.log({'Assimilated {0} into collective'.format(drone)})
def get_leader(connection):
if currentleader is None or connection.getpeername()[0] == currentleader: