summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2019-03-23 18:31:34 -0700
committerDana Powers <dana.powers@gmail.com>2019-03-23 18:31:34 -0700
commite64418e999db5e55ab2cdc62293f740bf03556b1 (patch)
tree498fd84ea98018e54c1d51192eb25c62b3d19bf5
parentce9c1d2e2b8d85b2f6c3b2a2ebd280246cfea07f (diff)
downloadkafka-python-0_8_2_protocol_parser_too.tar.gz
Revert 703f0659 / fix 0.8.2 protocol quick detection0_8_2_protocol_parser_too
-rw-r--r--kafka/conn.py3
-rw-r--r--kafka/protocol/parser.py12
2 files changed, 9 insertions, 6 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index 9353cf2..33950db 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -240,9 +240,6 @@ class BrokerConnection(object):
self.node_id = self.config.pop('node_id')
- if self.config['api_version'] is None:
- self.config['api_version'] = self.DEFAULT_CONFIG['api_version']
-
if self.config['receive_buffer_bytes'] is not None:
self.config['socket_options'].append(
(socket.SOL_SOCKET, socket.SO_RCVBUF,
diff --git a/kafka/protocol/parser.py b/kafka/protocol/parser.py
index a99b3ae..cfee046 100644
--- a/kafka/protocol/parser.py
+++ b/kafka/protocol/parser.py
@@ -18,6 +18,12 @@ class KafkaProtocol(object):
Use an instance of KafkaProtocol to manage bytes send/recv'd
from a network socket to a broker.
+
+ Arguments:
+ client_id (str): identifier string to be included in each request
+ api_version (tuple): Optional tuple to specify api_version to use.
+ Currently only used to check for 0.8.2 protocol quirks, but
+ may be used for more in the future.
"""
def __init__(self, client_id=None, api_version=None):
if client_id is None:
@@ -141,10 +147,10 @@ class KafkaProtocol(object):
(correlation_id, request) = self.in_flight_requests.popleft()
# 0.8.2 quirk
- if (self._api_version == (0, 8, 2) and
- request.RESPONSE_TYPE is GroupCoordinatorResponse[0] and
+ if (recv_correlation_id == 0 and
correlation_id != 0 and
- recv_correlation_id == 0):
+ request.RESPONSE_TYPE is GroupCoordinatorResponse[0] and
+ (self._api_version == (0, 8, 2) or self._api_version is None)):
log.warning('Kafka 0.8.2 quirk -- GroupCoordinatorResponse'
' Correlation ID does not match request. This'
' should go away once at least one topic has been'