diff --git a/pymysqlreplication/binlogstream.py b/pymysqlreplication/binlogstream.py index 7f3ce100..85c9df6a 100644 --- a/pymysqlreplication/binlogstream.py +++ b/pymysqlreplication/binlogstream.py @@ -596,6 +596,11 @@ def fetchone(self): if code in MYSQL_EXPECTED_ERROR_CODES: self._stream_connection.close() self.__connected_stream = False + logging.WARN( + """ + A pymysql.OperationalError error occurred, Re-request the connection. + """ + ) continue raise @@ -635,7 +640,9 @@ def fetchone(self): # invalidates all our cached table id to schema mappings. This means we have to load them all # again for each logfile which is potentially wasted effort but we can't really do much better # without being broken in restart case - self.table_map = {} + if binlog_event.timestamp != 0: + self.table_map = {} + elif binlog_event.log_pos: self.log_pos = binlog_event.log_pos diff --git a/pymysqlreplication/row_event.py b/pymysqlreplication/row_event.py index 201fe134..b371fcef 100644 --- a/pymysqlreplication/row_event.py +++ b/pymysqlreplication/row_event.py @@ -1,4 +1,3 @@ -import logging import struct import decimal import datetime @@ -36,12 +35,6 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs) self.table = self.table_map[self.table_id].table except KeyError: # If we have filter the corresponding TableMap Event self._processed = False - logging.log( - logging.WARN, - """ - A pymysql.OperationalError error occurred, causing a fake rotate event and initialization of the table_map - """, - ) return if self.__only_tables is not None and self.table not in self.__only_tables: