-
Notifications
You must be signed in to change notification settings - Fork 71
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
schema-reader: Log the erroring kafka message key #963
Conversation
515f785
to
a43b230
Compare
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
Left a comment but LGTM |
- we add the kafka message key to the log in the case of an error, this makes it easier to debug issues - we also add a check for kafka messages without a key
a43b230
to
25889f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
except AssertionError as exc: | ||
LOG.warning("Empty msg.key() at offset %s", msg.offset()) | ||
self.offset = msg.offset() # Invalid entry shall also move the offset so Karapace makes progress. | ||
self.kafka_error_handler.handle_error(location=KafkaErrorLocation.SCHEMA_READER, error=exc) | ||
continue # [non-strict mode] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this looks like a bit of a sketchy idea, an AssertionError
could come from deeper in the code, and this essentially abuses the assert
to function as a goto
. AssertionError
should really never be caught, bar some special cases in test harnessing code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an AssertionError
is raised from msg.key()
or msg.error()
, the correct behavior is for the code to fall over, and be restarted by the scheduler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this had existed prior to this change, we can take a look later.
About this change - What it does