Skip to content

Commit 0117ace

Browse files
authored
Log warning when attempting to list offsets for unknown topic/partition (#2540)
1 parent febfdac commit 0117ace

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kafka/consumer/fetcher.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,13 @@ def _send_list_offsets_requests(self, timestamps):
538538
for partition, timestamp in six.iteritems(timestamps):
539539
node_id = self._client.cluster.leader_for_partition(partition)
540540
if node_id is None:
541+
if partition.topic not in self._client.cluster.topics():
542+
log.warning("Could not lookup offsets for partition %s since no metadata is available for topic. "
543+
"Wait for metadata refresh and try again", partition)
544+
else:
545+
log.warning("Could not lookup offsets for partition %s since no metadata is available for it. "
546+
"Wait for metadata refresh and try again", partition)
541547
self._client.add_topic(partition.topic)
542-
log.debug("Partition %s is unknown for fetching offset,"
543-
" wait for metadata refresh", partition)
544548
return Future().failure(Errors.StaleMetadata(partition))
545549
elif node_id == -1:
546550
log.debug("Leader for partition %s unavailable for fetching "

0 commit comments

Comments
 (0)