krowinski / php-mysql-replication

Pure PHP Implementation of MySQL replication protocol. This allow you to receive event like insert, update, delete with their data and raw SQL queries.
MIT License
323 stars 98 forks source link

fix sending more than 16MB <2> #47

Closed kobi97 closed 6 years ago

kobi97 commented 6 years ago

Hello Krowinski I am sorry for my previous patch. Because I found my misunderstanding about divided packets. There is only one binlog event header for divided packets. Please check my CODE or my explain below and then you may get it.


This is MySQL Internals Manual: Sending More Than 16Mbytes https://dev.mysql.com/doc/internals/en/mysql-packet.html

If a MySQL client or server wants to send data, it:
- Splits the data into packets of size (2^24−1) bytes
- Prepends to each chunk a packet header

These are 3 divided packets for Insert Statement with 40Mb field in my test.

header<int(3)> + sequence<int(1)> + payload including binlog event header<string(16,777,215)> +
header<int(3)> + sequence<int(1)> + payload<string(16,777,215)> +
header<int(3)> + sequence<int(1)> + payload<string(6,445,616)>

This is my test environment:

Thank for reading :)

krowinski commented 6 years ago

Hi @kobi97 tx for patch, I was thinking if is possible for you to write integration test for that case to be sure that is working ?

kobi97 commented 6 years ago

It is OK with me but I have enough time only in weekend - if it would not be so late for you, I will try to write this weekend.

krowinski commented 6 years ago

same here I got little time in weekend

kobi97 commented 6 years ago

I have changed ".travis.yml", you may have to change config in Scrutinizer.

krowinski commented 6 years ago

Cool its working tx!