-
Notifications
You must be signed in to change notification settings - Fork 680
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
Add error logging for crc32 validation failures. #563
Conversation
Co-authored-by: jaehyeonpy jaehyeonpy@gmail.com Co-authored-by: davinc71998 davinc71998@gmail.com
pymysqlreplication/event.py
Outdated
if byte_data == footer: | ||
self._is_event_valid = True | ||
else: | ||
self._is_event_valid = False | ||
logging.error( | ||
f"An CRC32 has failed for the event type {self.event_type}, " | ||
"indicating a potential integrity issue with the data." | ||
) |
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 byte_data == footer: | |
self._is_event_valid = True | |
else: | |
self._is_event_valid = False | |
logging.error( | |
f"An CRC32 has failed for the event type {self.event_type}, " | |
"indicating a potential integrity issue with the data." | |
) | |
self._is_event_valid = True if byte_data == footer else False | |
if not self._is_event_valid: | |
logging.error( | |
f"An CRC32 has failed for the event type {self.event_type}, " | |
"indicating a potential integrity issue with the data." | |
) |
@why-arong
I think this looks more readable, what do you think?
I think the code you wrote is good, too.
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.
I think that code reads better!
How about error message? Is there any additional information we can provide besides 'self.event_type'
??
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.
I think that's enough
python-mysql-replication/pymysqlreplication/binlogstream.py Lines 553 to 558 in 1d2c8ab
How do you feel about not writing the code like |
logging.error is more better👍 |
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 Thanks your hard work!
Description
This PR add logging for situations where CRC32 validation does not pass.
By monitoring these failures, we can ensure data integrity throughout the application.