Fix of exception raise in case of auto_offset_reset is set to None in KafkaConsumer (#860)

This commit is contained in:
Alexander Sibiryakov
2016-12-28 00:38:52 +01:00
committed by Dana Powers
parent 4acb7f4434
commit 2e80fbb0c2

View File

@@ -747,12 +747,12 @@ class Fetcher(six.Iterator):
self._client.cluster.request_update()
elif error_type is Errors.OffsetOutOfRangeError:
fetch_offset = fetch_offsets[tp]
log.info("Fetch offset %s is out of range for topic-partition %s", fetch_offset, tp)
if self._subscriptions.has_default_offset_reset_policy():
self._subscriptions.need_offset_reset(tp)
log.info("Resetting offset for topic-partition %s", tp)
else:
self._offset_out_of_range_partitions[tp] = fetch_offset
log.info("Fetch offset %s is out of range, resetting offset",
fetch_offset)
elif error_type is Errors.TopicAuthorizationFailedError:
log.warn("Not authorized to read from topic %s.", tp.topic)
self._unauthorized_topics.add(tp.topic)