Skip to content

Commit a2a36e7

Browse files
author
Lior Sion
committed
disable reporting on non implemented events to help testing
1 parent 46680eb commit a2a36e7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pymysqlreplication/binlogstream.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
from .packet import BinLogPacketWrapper
1111
from .constants.BINLOG import TABLE_MAP_EVENT, ROTATE_EVENT
12-
12+
from .event import NotImplementedEvent
1313

1414
class BinLogStreamReader(object):
1515
"""Connect to replication stream and read event
1616
"""
1717

1818
def __init__(self, connection_settings={}, resume_stream=False,
1919
blocking=False, only_events=None, server_id=255,
20-
log_file=None, log_pos=None):
20+
log_file=None, log_pos=None, filter_non_implemented_events=True):
2121
"""
2222
Attributes:
2323
resume_stream: Start for event from position or the latest event of
@@ -35,6 +35,7 @@ def __init__(self, connection_settings={}, resume_stream=False,
3535
self.__resume_stream = resume_stream
3636
self.__blocking = blocking
3737
self.__only_events = only_events
38+
self.__filter_non_implemented_events = filter_non_implemented_events
3839
self.__server_id = server_id
3940

4041
#Store table meta information
@@ -132,6 +133,9 @@ def fetchone(self):
132133
return binlog_event.event
133134

134135
def __filter_event(self, event):
136+
if self.__filter_non_implemented_events and isinstance(event, NotImplementedEvent):
137+
return True
138+
135139
if self.__only_events is not None:
136140
for allowed_event in self.__only_events:
137141
if isinstance(event, allowed_event):

0 commit comments

Comments
 (0)