Skip to content
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

Retry on temporary errors from schema reader #849

Merged
merged 1 commit into from
Apr 10, 2024
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
7 changes: 7 additions & 0 deletions karapace/schema_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
InvalidReplicationFactorError,
KafkaConfigurationError,
KafkaTimeoutError,
LeaderNotAvailableError,
NoBrokersAvailable,
NodeNotReadyError,
NotLeaderForPartitionError,
TopicAlreadyExistsError,
TopicAuthorizationFailedError,
UnknownTopicOrPartitionError,
Expand Down Expand Up @@ -246,6 +248,8 @@ def _get_beginning_offset(self) -> int:
LOG.warning("Reading begin offsets timed out.")
except UnknownTopicOrPartitionError:
LOG.warning("Topic does not yet exist.")
except (LeaderNotAvailableError, NotLeaderForPartitionError):
LOG.warning("Retrying to find leader for schema topic partition.")
except Exception as e: # pylint: disable=broad-except
self.stats.unexpected_exception(ex=e, where="_get_beginning_offset")
LOG.exception("Unexpected exception when reading begin offsets.")
Expand All @@ -265,6 +269,9 @@ def _is_ready(self) -> bool:
except UnknownTopicOrPartitionError:
LOG.warning("Topic does not yet exist.")
return False
except (LeaderNotAvailableError, NotLeaderForPartitionError):
LOG.warning("Retrying to find leader for schema topic partition.")
return False
except Exception as e: # pylint: disable=broad-except
self.stats.unexpected_exception(ex=e, where="_is_ready")
LOG.exception("Unexpected exception when reading end offsets.")
Expand Down
Loading