summaryrefslogtreecommitdiff
path: root/kafka/coordinator/base.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2019-06-19 13:41:59 -0700
committerJeff Widman <jeff@jeffwidman.com>2019-06-19 13:41:59 -0700
commit91f4642e92afc208531f66cea1ed7ef32bcfa4d1 (patch)
tree82e08036d43a297c865d4766b4198bac951ee9bb /kafka/coordinator/base.py
parentf126e5bfcc8f41ee5ea29b41ec6eabbc3f441647 (diff)
downloadkafka-python-91f4642e92afc208531f66cea1ed7ef32bcfa4d1.tar.gz
Use dedicated connection for group coordinator (#1822)
This changes the coordinator_id to be a unique string, e.g., `coordinator-1`, so that it will get a dedicated connection. This won't eliminate lock contention because the client lock applies to all connections, but it should improve in-flight-request contention.
Diffstat (limited to 'kafka/coordinator/base.py')
-rw-r--r--kafka/coordinator/base.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/kafka/coordinator/base.py b/kafka/coordinator/base.py
index e538fda..421360e 100644
--- a/kafka/coordinator/base.py
+++ b/kafka/coordinator/base.py
@@ -676,14 +676,14 @@ class BaseCoordinator(object):
error_type = Errors.for_code(response.error_code)
if error_type is Errors.NoError:
with self._client._lock, self._lock:
- ok = self._client.cluster.add_group_coordinator(self.group_id, response)
- if not ok:
+ coordinator_id = self._client.cluster.add_group_coordinator(self.group_id, response)
+ if not coordinator_id:
# This could happen if coordinator metadata is different
# than broker metadata
future.failure(Errors.IllegalStateError())
return
- self.coordinator_id = response.coordinator_id
+ self.coordinator_id = coordinator_id
log.info("Discovered coordinator %s for group %s",
self.coordinator_id, self.group_id)
self._client.maybe_connect(self.coordinator_id)