Skip to content

Commit 6850c0d

Browse files
authored
Merge pull request #579 from julien-duponchelle/fake-rotate-event-check
fake rotate event check
2 parents ca3ab06 + 1d5dfcf commit 6850c0d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Diff for: pymysqlreplication/binlogstream.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,11 @@ def fetchone(self):
596596
if code in MYSQL_EXPECTED_ERROR_CODES:
597597
self._stream_connection.close()
598598
self.__connected_stream = False
599+
logging.WARN(
600+
"""
601+
A pymysql.OperationalError error occurred, Re-request the connection.
602+
"""
603+
)
599604
continue
600605
raise
601606

@@ -635,7 +640,9 @@ def fetchone(self):
635640
# invalidates all our cached table id to schema mappings. This means we have to load them all
636641
# again for each logfile which is potentially wasted effort but we can't really do much better
637642
# without being broken in restart case
638-
self.table_map = {}
643+
if binlog_event.timestamp != 0:
644+
self.table_map = {}
645+
639646
elif binlog_event.log_pos:
640647
self.log_pos = binlog_event.log_pos
641648

Diff for: pymysqlreplication/row_event.py

-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import logging
21
import struct
32
import decimal
43
import datetime
@@ -36,12 +35,6 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
3635
self.table = self.table_map[self.table_id].table
3736
except KeyError: # If we have filter the corresponding TableMap Event
3837
self._processed = False
39-
logging.log(
40-
logging.WARN,
41-
"""
42-
A pymysql.OperationalError error occurred, causing a fake rotate event and initialization of the table_map
43-
""",
44-
)
4538
return
4639

4740
if self.__only_tables is not None and self.table not in self.__only_tables:

0 commit comments

Comments
 (0)