2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-04-29 08:25:57 +00:00

Fix configmanager msgpack

msgpack method had some regressions.  For one, python2 strings
became bytes on mixed collective, fix by using raw=False on the
receiver.

Additionally, del_nodes tends to use sets, and that's not viable for
msgpack.  Guard against that.
This commit is contained in:
Jarrod Johnson 2020-01-29 09:24:57 -05:00
parent 9f7c8c69f2
commit 4be4100014

View File

@ -607,7 +607,7 @@ def relay_slaved_requests(name, listener):
if not nrpc:
raise Exception('Truncated client error')
rpc += nrpc
rpc = msgpack.unpackb(rpc)
rpc = msgpack.unpackb(rpc, raw=False)
exc = None
if not (rpc['function'].startswith('_rpc_') or rpc['function'].endswith('_collective_member')):
raise Exception('Unsupported function {0} called'.format(rpc['function']))
@ -763,7 +763,7 @@ def follow_channel(channel):
if not nrpc:
raise Exception('Truncated message error')
rpc += nrpc
rpc = msgpack.unpackb(rpc)
rpc = msgpack.unpackb(rpc, raw=False)
if 'txcount' in rpc:
_txcount = rpc['txcount']
if 'function' in rpc:
@ -1886,6 +1886,8 @@ class ConfigManager(object):
eventlet.spawn_n(_do_notifier, self, watcher, callback)
def del_nodes(self, nodes):
if isinstance(nodes, set):
nodes = list(nodes) # msgpack can't handle set
if cfgleader: # slaved to a collective
return exec_on_leader('_rpc_master_del_nodes', self.tenant,
nodes)