Skip to content

Commit

Permalink
fake rotate event check
Browse files Browse the repository at this point in the history
not initailizing  table map when fake rotate Event

add black lint
  • Loading branch information
sean-k1 committed Nov 23, 2023
1 parent ca3ab06 commit 1d5dfcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 8 additions & 1 deletion pymysqlreplication/binlogstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions pymysqlreplication/row_event.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import struct
import decimal
import datetime
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1d5dfcf

Please sign in to comment.