Skip to content

Log warning when attempting to list offsets for unknown topic/partition #2540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions kafka/consumer/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,13 @@ def _send_list_offsets_requests(self, timestamps):
for partition, timestamp in six.iteritems(timestamps):
node_id = self._client.cluster.leader_for_partition(partition)
if node_id is None:
if partition.topic not in self._client.cluster.topics():
log.warning("Could not lookup offsets for partition %s since no metadata is available for topic. "
"Wait for metadata refresh and try again", partition)
else:
log.warning("Could not lookup offsets for partition %s since no metadata is available for it. "
"Wait for metadata refresh and try again", partition)
self._client.add_topic(partition.topic)
log.debug("Partition %s is unknown for fetching offset,"
" wait for metadata refresh", partition)
return Future().failure(Errors.StaleMetadata(partition))
elif node_id == -1:
log.debug("Leader for partition %s unavailable for fetching "
Expand Down
Loading