Skip to content

Commit 22e3f75

Browse files
authored
Do not validate api_version against known versions (dpkp#1434)
1 parent acbc346 commit 22e3f75

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

kafka/client_async.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ class KafkaClient(object):
121121
default: none.
122122
api_version (tuple): Specify which Kafka API version to use. If set
123123
to None, KafkaClient will attempt to infer the broker version by
124-
probing various APIs. For the full list of supported versions,
125-
see KafkaClient.API_VERSIONS. Default: None
124+
probing various APIs. Example: (0, 10, 2). Default: None
126125
api_version_auto_timeout_ms (int): number of milliseconds to throw a
127126
timeout exception from the constructor when checking the broker
128127
api version. Only applies if api_version is None
@@ -176,27 +175,13 @@ class KafkaClient(object):
176175
'sasl_plain_password': None,
177176
'sasl_kerberos_service_name': 'kafka',
178177
}
179-
API_VERSIONS = [
180-
(0, 10, 1),
181-
(0, 10, 0),
182-
(0, 10),
183-
(0, 9),
184-
(0, 8, 2),
185-
(0, 8, 1),
186-
(0, 8, 0)
187-
]
188178

189179
def __init__(self, **configs):
190180
self.config = copy.copy(self.DEFAULT_CONFIG)
191181
for key in self.config:
192182
if key in configs:
193183
self.config[key] = configs[key]
194184

195-
if self.config['api_version'] is not None:
196-
assert self.config['api_version'] in self.API_VERSIONS, (
197-
'api_version [{0}] must be one of: {1}'.format(
198-
self.config['api_version'], str(self.API_VERSIONS)))
199-
200185
self.cluster = ClusterMetadata(**self.config)
201186
self._topics = set() # empty set will fetch all topic metadata
202187
self._metadata_refresh_in_progress = False

kafka/consumer/group.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ class KafkaConsumer(six.Iterator):
208208
(0, 8, 0) enables basic functionality but requires manual
209209
partition assignment and offset management.
210210
211-
For the full list of supported versions, see
212-
KafkaClient.API_VERSIONS. Default: None
211+
Default: None
213212
api_version_auto_timeout_ms (int): number of milliseconds to throw a
214213
timeout exception from the constructor when checking the broker
215214
api version. Only applies if api_version set to 'auto'

kafka/producer/kafka.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ class KafkaProducer(object):
242242
default: none.
243243
api_version (tuple): Specify which Kafka API version to use. If set to
244244
None, the client will attempt to infer the broker version by probing
245-
various APIs. For a full list of supported versions, see
246-
KafkaClient.API_VERSIONS. Default: None
245+
various APIs. Example: (0, 10, 2). Default: None
247246
api_version_auto_timeout_ms (int): number of milliseconds to throw a
248247
timeout exception from the constructor when checking the broker
249248
api version. Only applies if api_version set to 'auto'

0 commit comments

Comments
 (0)