Ensure coordination IDs are encoded

Ensure coordination IDs are encoded when working with coordination
backend. This fixes an issue when upgrading to Python 3 (where bytes
and str are different types) and _update_partitions() attempts to
sort types of 'str' and 'bytes', causing designate-producer to crash.

Change-Id: Id8206ee5285d3a73e00ef21b7d3961a29c23ab4b
Closes-Bug: #1828534
This commit is contained in:
Corey Bryant 2019-07-29 15:44:48 -04:00
parent 076f9fce0a
commit 556a27e4e9
3 changed files with 15 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class CoordinationMixin(object):
backend_url = CONF.coordination.backend_url
self._coordinator = tooz.coordination.get_coordinator(
backend_url, self._coordination_id)
backend_url, self._coordination_id.encode())
self._coordination_started = False
self.tg.add_timer(CONF.coordination.heartbeat_interval,

View File

@ -66,8 +66,8 @@ class Service(service.RPCService, coordination.CoordinationMixin,
super(Service, self).start()
self._partitioner = coordination.Partitioner(
self._coordinator, self.service_name, self._coordination_id,
range(0, 4095))
self._coordinator, self.service_name,
self._coordination_id.encode(), range(0, 4095))
self._partitioner.start()
self._partitioner.watch_partition_change(self._rebalance)

View File

@ -0,0 +1,12 @@
---
upgrade:
- |
While this patch fixes upgrades from patched Python 2 to patched
Python 3 designate releases, the issue will still be present on
upgrade from unpatched Python 3 to patched Python 3 designate
releases.
fixes:
- |
This fixes an issue when upgrading to Python 3 (where bytes and str are
different types) and _update_partitions() attempts to sort types of 'str'
and 'bytes', causing designate-producer to crash.