Skip to content

Commit ee27a5f

Browse files
committed
Revert "setting BinlogStream class parameter optional_meta_data "
This reverts commit b882122.
1 parent 725f035 commit ee27a5f

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

pymysqlreplication/binlogstream.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ def __init__(self, connection_settings, server_id,
142142
slave_heartbeat=None,
143143
is_mariadb=False,
144144
annotate_rows_event=False,
145-
ignore_decode_errors=False,
146-
optional_meta_data=False):
145+
ignore_decode_errors=False):
147146
"""
148147
Attributes:
149148
ctl_connection_settings: Connection settings for cluster holding
@@ -207,7 +206,7 @@ def __init__(self, connection_settings, server_id,
207206
only_events, ignored_events, filter_non_implemented_events)
208207
self.__fail_on_table_metadata_unavailable = fail_on_table_metadata_unavailable
209208
self.__ignore_decode_errors = ignore_decode_errors
210-
self.__optional_meta_data = optional_meta_data
209+
211210
# We can't filter on packet level TABLE_MAP and rotate event because
212211
# we need them for handling other operations
213212
self.__allowed_events_in_packet = frozenset(
@@ -537,8 +536,7 @@ def fetchone(self):
537536
self.__ignored_schemas,
538537
self.__freeze_schema,
539538
self.__fail_on_table_metadata_unavailable,
540-
self.__ignore_decode_errors,
541-
self.__optional_meta_data)
539+
self.__ignore_decode_errors)
542540

543541
if binlog_event.event_type == ROTATE_EVENT:
544542
self.log_pos = binlog_event.event.position

pymysqlreplication/event.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection,
1616
ignored_schemas=None,
1717
freeze_schema=False,
1818
fail_on_table_metadata_unavailable=False,
19-
ignore_decode_errors=False,
20-
optional_meta_data=False):
19+
ignore_decode_errors=False):
2120
self.packet = from_packet
2221
self.table_map = table_map
2322
self.event_type = self.packet.event_type

pymysqlreplication/packet.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def __init__(self, from_packet, table_map,
105105
ignored_schemas,
106106
freeze_schema,
107107
fail_on_table_metadata_unavailable,
108-
ignore_decode_errors,
109-
optional_meta_data):
108+
ignore_decode_errors):
110109
# -1 because we ignore the ok byte
111110
self.read_bytes = 0
112111
# Used when we want to override a value in the data buffer
@@ -152,8 +151,7 @@ def __init__(self, from_packet, table_map,
152151
ignored_schemas=ignored_schemas,
153152
freeze_schema=freeze_schema,
154153
fail_on_table_metadata_unavailable=fail_on_table_metadata_unavailable,
155-
ignore_decode_errors=ignore_decode_errors,
156-
optional_meta_data=optional_meta_data)
154+
ignore_decode_errors=ignore_decode_errors)
157155
if self.event._processed == False:
158156
self.event = None
159157

pymysqlreplication/row_event.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
634634
self.__only_schemas = kwargs["only_schemas"]
635635
self.__ignored_schemas = kwargs["ignored_schemas"]
636636
self.__freeze_schema = kwargs["freeze_schema"]
637-
self.__optional_meta_data = kwargs["optional_meta_data"]
637+
638638
# Post-Header
639639
self.table_id = self._read_table_id()
640640

@@ -672,8 +672,6 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
672672

673673
if self.table_id in table_map:
674674
self.column_schemas = table_map[self.table_id].column_schemas
675-
elif self.__optional_meta_data:
676-
self.column_schemas = []
677675
else:
678676
self.column_schemas = self._ctl_connection._get_table_information(self.schema, self.table)
679677

@@ -813,8 +811,10 @@ def _sync_column_info(self):
813811
column_schemas = []
814812
if len(self.optional_metadata.column_name_list) == 0:
815813
return
816-
if not self.__optional_meta_data:
817-
# If optional_meta_data is False Do not sync Event Time Column Schemas
814+
if len(self.column_schemas) == self.column_count:
815+
# If the column schema length matches the number of columns,
816+
# updating column schema information from optional metadata is not advisable.
817+
# The reason is that the information obtained from optional metadata is not sufficient.
818818
return
819819

820820
charset_pos = 0

0 commit comments

Comments
 (0)