2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-16 04:39:16 +00:00

Fix error when trying to do fullsync without globals yet

If globals is missing, then do not break the sync trying to handle it
This commit is contained in:
Jarrod Johnson 2018-10-10 13:10:41 -04:00
parent b77ed8dbff
commit 32ddb33de3
2 changed files with 5 additions and 4 deletions

View File

@ -82,7 +82,7 @@ def connect_to_leader(cert=None, name=None, leader=None):
log.log({
'info': 'Collective initialization in progress on '
'{0}, will retry connection'.format(leader),
'subsystem': 'collective'}) ####### bad idea?
'subsystem': 'collective'})
eventlet.spawn_after(random.random(), connect_to_leader,
cert, name, leader)
return True

View File

@ -968,7 +968,7 @@ class ConfigManager(object):
_cfgstore['main'] = {}
self._bg_sync_to_file()
self._cfgstore = _cfgstore['main']
if 'nodegroups' not in self._cfgstore:
if 'nodegroups' not in self._cfgstore: # This can happen during a clear... it seams... and if so it messes up...
self._cfgstore['nodegroups'] = {'everything': {'nodes': set()}}
_mark_dirtykey('nodegroups', 'everything', self.tenant)
self._bg_sync_to_file()
@ -2080,8 +2080,9 @@ class ConfigManager(object):
_mkpath(cls._cfgdir)
with open(os.path.join(cls._cfgdir, 'transactioncount'), 'w') as f:
f.write(struct.pack('!Q', _txcount))
if fullsync or 'dirtyglobals' in _cfgstore:
if fullsync:
if (fullsync or 'dirtyglobals' in _cfgstore and
'globals' in _cfgstore):
if fullsync: # globals is not a given to be set..
dirtyglobals = _cfgstore['globals']
else:
with _dirtylock: