Skip to content

Commit 6c36333

Browse files
committed
1 parent 2b95a95 commit 6c36333

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pymysqlreplication/row_event.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,20 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs)
5959
self.flags, self.extra_data_length = struct.unpack('<HH', self.packet.read(4))
6060
if self.extra_data_length > 2:
6161
self.extra_data_type = struct.unpack('<B', self.packet.read(1))[0]
62+
63+
# ndb information
64+
if self.extra_data_type == 0:
65+
self.nbd_info_length, self.nbd_info_format = struct.unpack('<BB', self.packet.read(1))
66+
self.nbd_info = self.packet.read(self.nbd_info_length - 2)
6267
# partition information
63-
if self.extra_data_type == 1:
68+
elif self.extra_data_type == 1:
6469
if self.event_type == BINLOG.UPDATE_ROWS_EVENT_V2:
6570
self.partition_id, self.source_partition_id = struct.unpack('<HH', self.packet.read(4))
6671
else:
6772
self.partition_id = struct.unpack('<H', self.packet.read(2))[0]
68-
# NDB information etc.
73+
# etc
6974
else:
70-
self.extra_data = self.packet.read(self.extra_data_length - 3)
75+
self.extra_data = self.packet.read(self.extra_info_length - 3)
7176
else:
7277
self.flags = struct.unpack('<H', self.packet.read(2))[0]
7378

pymysqlreplication/tests/test_data_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def test_extra_data(self):
634634
PARTITION p1 VALUES LESS THAN (2), \
635635
PARTITION p2 VALUES LESS THAN (3), \
636636
PARTITION p3 VALUES LESS THAN (4), \
637-
PARTITION p4 VALUES LESS THAN (5), \
637+
PARTITION p4 VALUES LESS THAN (5) \
638638
)"
639639
insert_query = "INSERT INTO test (id) VALUES(3)"
640640
event = self.create_and_insert_value(create_query, insert_query)

0 commit comments

Comments
 (0)