Skip to content

Commit 08a8fe3

Browse files
authored
Merge pull request julien-duponchelle#563 from why-arong/crc32_logging
Add error logging for crc32 validation failures.
2 parents 3bae489 + e8bb235 commit 08a8fe3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pymysqlreplication/event.py

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime
44
import decimal
55
import zlib
6+
import logging
67

78
from pymysqlreplication.constants.STATUS_VAR_KEY import *
89
from pymysqlreplication.exceptions import StatusVariableMismatch
@@ -58,6 +59,11 @@ def _verify_event(self):
5859
footer = self.packet.read(4)
5960
byte_data = zlib.crc32(data).to_bytes(4, byteorder="little")
6061
self._is_event_valid = True if byte_data == footer else False
62+
if not self._is_event_valid:
63+
logging.error(
64+
f"An CRC32 has failed for the event type {self.event_type}, "
65+
"indicating a potential integrity issue with the data."
66+
)
6167
self.packet.read_bytes -= 19 + self.event_size + 4
6268
self.packet.rewind(20)
6369

0 commit comments

Comments
 (0)