From 0724ad812b924ec433fa48a6a90573cca31bf79b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 27 Sep 2018 10:38:00 -0400 Subject: [PATCH] Add logging to the assimilation phase of collective When attempting assimilation, provide logging about the attempt. --- .../confluent/collective/manager.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/collective/manager.py b/confluent_server/confluent/collective/manager.py index dae9279c..9c864bfc 100644 --- a/confluent_server/confluent/collective/manager.py +++ b/confluent_server/confluent/collective/manager.py @@ -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: