2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-12 16:49:42 +00:00

Fix per-collective globals

set_global is explicitly not
collective enabled, however
collective was causing partial
propagation.

Fix by removing the global carry over and having
commit_clear restore the non-key globals.
This commit is contained in:
Jarrod Johnson 2020-07-09 09:10:24 -04:00
parent 2c151caae7
commit 68c4652662
2 changed files with 12 additions and 3 deletions

View File

@ -120,6 +120,7 @@ def connect_to_leader(cert=None, name=None, leader=None):
log.log({'info': 'Following leader {0}'.format(leader),
'subsystem': 'collective'})
colldata = tlvdata.recv(remote)
# the protocol transmits global data, but for now we ignore it
globaldata = tlvdata.recv(remote)
dbi = tlvdata.recv(remote)
dbsize = dbi['dbsize']
@ -140,8 +141,8 @@ def connect_to_leader(cert=None, name=None, leader=None):
cfm._true_add_collective_member(c, colldata[c]['address'],
colldata[c]['fingerprint'],
sync=False)
for globvar in globaldata:
cfm.set_global(globvar, globaldata[globvar], False)
#for globvar in globaldata:
# cfm.set_global(globvar, globaldata[globvar], False)
cfm._txcount = dbi.get('txcount', 0)
cfm.ConfigManager(tenant=None)._load_from_json(dbjson,
sync=False)
@ -463,7 +464,7 @@ def handle_connection(connection, cert, request, local=False):
connection.getpeername()[0])
tlvdata.send(connection, cfm._dump_keys(None, False))
tlvdata.send(connection, cfm._cfgstore['collective'])
tlvdata.send(connection, cfm.get_globals())
tlvdata.send(connection, {}) # cfm.get_globals())
cfgdata = cfm.ConfigManager(None)._dump_to_json()
tlvdata.send(connection, {'txcount': cfm._txcount,
'dbsize': len(cfgdata)})

View File

@ -769,6 +769,14 @@ def clear_configuration():
def commit_clear():
global _oldtxcount
global _oldcfgstore
# first, copy over old non-key globals, as those are
# currently defined as local to each collective member
# currently just 'autosense' which is intended to be active
# per collective member
for globvar in _oldcfgstore['globals']:
if globvar.endswith('_key'):
continue
_cfgstore['globals'][globvar] = _oldcfgstore['globals'][globvar]
_oldcfgstore = None
_oldtxcount = 0
with _synclock: