Skip to content

Commit 7cee733

Browse files
committed
fake rotate event check
logging delete logging change
1 parent ca3ab06 commit 7cee733

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pymysqlreplication/binlogstream.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ def __check_optional_meta_data(self):
577577

578578
def fetchone(self):
579579
while True:
580+
fake_rotate_flag = False
580581
if self.end_log_pos and self.is_past_end_log_pos:
581582
return None
582583

@@ -596,6 +597,12 @@ def fetchone(self):
596597
if code in MYSQL_EXPECTED_ERROR_CODES:
597598
self._stream_connection.close()
598599
self.__connected_stream = False
600+
logging.WARN(
601+
"""
602+
A pymysql.OperationalError error occurred, Re-request the connection.
603+
"""
604+
)
605+
fake_rotate_flag = True
599606
continue
600607
raise
601608

@@ -623,7 +630,7 @@ def fetchone(self):
623630
self.__optional_meta_data,
624631
)
625632

626-
if binlog_event.event_type == ROTATE_EVENT:
633+
if binlog_event.event_type == ROTATE_EVENT and not fake_rotate_flag:
627634
self.log_pos = binlog_event.event.position
628635
self.log_file = binlog_event.event.next_binlog
629636
# Table Id in binlog are NOT persistent in MySQL - they are in-memory identifiers

pymysqlreplication/row_event.py

-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
3636
self.table = self.table_map[self.table_id].table
3737
except KeyError: # If we have filter the corresponding TableMap Event
3838
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-
)
4539
return
4640

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

0 commit comments

Comments
 (0)