From 04b48fa83ff466ec9c818295094025a7cdb1d1a7 Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 24 Aug 2023 16:02:48 +0900 Subject: [PATCH 1/2] fix bug timing of event creation and the timing of querying the table structure are different, ex) drop table but replication did not reach that point f self.column_schemas doesn't yield any results, the code will exit the if statement. However, since there is more column information in the remaining packets, if the column.count is not 0, we still need to read the packets. --- pymysqlreplication/row_event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymysqlreplication/row_event.py b/pymysqlreplication/row_event.py index 513ce2dc..86af1967 100644 --- a/pymysqlreplication/row_event.py +++ b/pymysqlreplication/row_event.py @@ -624,7 +624,7 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs) ordinal_pos_loc = 0 - if len(self.column_schemas) != 0: + if self.column_count != 0: # Read columns meta data column_types = bytearray(self.packet.read(self.column_count)) self.packet.read_length_coded_binary() From a9585d99f0b5e5588f727ad9b676ff92334a17fb Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 24 Aug 2023 16:17:36 +0900 Subject: [PATCH 2/2] fix --- pymysqlreplication/row_event.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pymysqlreplication/row_event.py b/pymysqlreplication/row_event.py index 86af1967..4c65f3ef 100644 --- a/pymysqlreplication/row_event.py +++ b/pymysqlreplication/row_event.py @@ -79,8 +79,9 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs) #Body self.number_of_columns = self.packet.read_length_coded_binary() self.columns = self.table_map[self.table_id].columns + column_schemas = self.table_map[self.table_id].column_schemas - if len(self.columns) == 0: # could not read the table metadata, probably already dropped + if len(column_schemas) == 0: # could not read the table metadata, probably already dropped self.complete = False if self._fail_on_table_metadata_unavailable: raise TableMetadataUnavailableError(self.table)