Skip to content

Commit 227a946

Browse files
authored
Revert 703f065 / fix 0.8.2 protocol quick detection (#1763)
1 parent e45b89b commit 227a946

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

kafka/conn.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,6 @@ def __init__(self, host, port, afi, **configs):
240240

241241
self.node_id = self.config.pop('node_id')
242242

243-
if self.config['api_version'] is None:
244-
self.config['api_version'] = self.DEFAULT_CONFIG['api_version']
245-
246243
if self.config['receive_buffer_bytes'] is not None:
247244
self.config['socket_options'].append(
248245
(socket.SOL_SOCKET, socket.SO_RCVBUF,

kafka/protocol/parser.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ class KafkaProtocol(object):
1818
1919
Use an instance of KafkaProtocol to manage bytes send/recv'd
2020
from a network socket to a broker.
21+
22+
Arguments:
23+
client_id (str): identifier string to be included in each request
24+
api_version (tuple): Optional tuple to specify api_version to use.
25+
Currently only used to check for 0.8.2 protocol quirks, but
26+
may be used for more in the future.
2127
"""
2228
def __init__(self, client_id=None, api_version=None):
2329
if client_id is None:
@@ -141,10 +147,10 @@ def _process_response(self, read_buffer):
141147
(correlation_id, request) = self.in_flight_requests.popleft()
142148

143149
# 0.8.2 quirk
144-
if (self._api_version == (0, 8, 2) and
145-
request.RESPONSE_TYPE is GroupCoordinatorResponse[0] and
150+
if (recv_correlation_id == 0 and
146151
correlation_id != 0 and
147-
recv_correlation_id == 0):
152+
request.RESPONSE_TYPE is GroupCoordinatorResponse[0] and
153+
(self._api_version == (0, 8, 2) or self._api_version is None)):
148154
log.warning('Kafka 0.8.2 quirk -- GroupCoordinatorResponse'
149155
' Correlation ID does not match request. This'
150156
' should go away once at least one topic has been'

0 commit comments

Comments
 (0)