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
318 stars 94 forks source link

Fatal error: Uncaught MySQLReplication\Exception\MySQLReplicationException: Unknown row type: 245 #14

Closed domyway closed 7 years ago

domyway commented 7 years ago

my table has a json field

krowinski commented 7 years ago

hmm I see that binary log keep

{"key1": "value1", "key2": "value2"}

as

' . "\0" . '' . "\0" . '(' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . ' ' . "\0" . ' !' . "\0" . 'key1key2value1value2

I need to find out how to decode.

I found decode example writed in java

https://github.com/shyiko/mysql-binlog-connector-java/blob/master/src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/json/JsonBinary.java

or

https://github.com/mysql/mysql-server/blob/5.7/sql/json_binary.h

domyway commented 7 years ago

rewrite the java example with php, waiting for your goods news . haha.

krowinski commented 7 years ago

I almost rewrited ;) have some problems with very long text like "text": "very long text" no always calculates length of string (I hate binary parsing ;)) When I have branch ready I give you to test it ;)

krowinski commented 7 years ago

16 New tag released 2.1.0 I have added basic support for json in time I will add more like opaque and big json data support.

domyway commented 7 years ago

great job! updating and do some testing right now . thanks first~~~

domyway commented 7 years ago
Server: Localhost via UNIX socket
Server type: MySQL
Server version: 5.7.9-log - MySQL Community Server (GPL)
Protocol version: 10
User: root@localhost
Server charset: UTF-8 Unicode (utf8)

binlog-format:row PHP version: 7.0.7 create table sql :

CREATE TABLE `hj_ad` (
 `id` int(13) NOT NULL AUTO_INCREMENT ,
 `ad_title` text NOT NULL ,
 `ad_image` text NOT NULL ,
 `ad_url` text NOT NULL ,
 `extra_data` json NOT NULL ,
 `ad_type` varchar(20) NOT NULL ,
 `start_date` int(13) NOT NULL DEFAULT '0' ,
 `end_date` int(13) NOT NULL DEFAULT '0' ,
 `is_del` int(1) NOT NULL DEFAULT '0' ,
 `add_time` int(13) NOT NULL COMMENT ,
 `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 

table data :

INSERT INTO `hj_ad` (`id`, `ad_title`, `ad_image`, `ad_url`, `extra_data`, `ad_type`, `start_date`, `end_date`, `is_del`, `add_time`, `last_update_time`) VALUES
(5, '3', 'http://test/country/o_1asi0hcm6ejjnvat8gqnkeme.jpg', 'http://test/subject/zhongqiu2016', 'null', 'carousel', 0, 0, 2147483647, 1473782415, '2016-11-22 07:28:32');

when i exexute sql :

UPDATE `hj_ad` SET `ad_title` = '3' WHERE `hj_ad`.`id` = 5;

dump_event.php output :

Warning: unpack(): Type i: not enough input, need 4, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 381

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1259    2142888   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:891
    8.1284    2195512   6. MySQLReplication\BinaryDataReader\BinaryDataReader->readInt32() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:340
    8.1284    2195544   7. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:381

Warning: unpack(): Type i: not enough input, need 4, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 381

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1259    2142888   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:891
    8.1388    2195512   6. MySQLReplication\BinaryDataReader\BinaryDataReader->readInt32() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:340
    8.1388    2195544   7. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:381

Warning: unpack(): Type i: not enough input, need 4, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 381

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1259    2142888   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:891
    8.1463    2195512   6. MySQLReplication\BinaryDataReader\BinaryDataReader->readInt32() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:340
    8.1463    2195544   7. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:381

Warning: unpack(): Type i: not enough input, need 4, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 381

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1259    2142888   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:891
    8.1574    2195832   6. MySQLReplication\BinaryDataReader\BinaryDataReader->readInt32() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:340
    8.1574    2195864   7. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:381

Warning: unpack(): Type i: not enough input, need 4, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 362

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1259    2142888   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:891
    8.1639    2195832   6. MySQLReplication\Event\RowEvent\RowEvent->getTimestamp2() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:411
    8.1639    2195832   7. MySQLReplication\BinaryDataReader\BinaryDataReader->readInt32Be() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:742
    8.1639    2195864   8. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:362

Notice: Uninitialized string offset: 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php on line 503

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1734    2196520   6. MySQLReplication\Event\RowEvent\RowEvent->checkNull() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:302

Warning: unpack(): Type i: not enough input, need 4, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 381

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1802    2196520   6. MySQLReplication\BinaryDataReader\BinaryDataReader->readInt32() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:340
    8.1802    2196552   7. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:381

Notice: Uninitialized string offset: 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php on line 503

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1900    2196840   6. MySQLReplication\Event\RowEvent\RowEvent->checkNull() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:302

Warning: unpack(): Type v: not enough input, need 2, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 135

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1916    2196840   6. MySQLReplication\Event\RowEvent\RowEvent->getString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:391
    8.1916    2196840   7. MySQLReplication\BinaryDataReader\BinaryDataReader->readLengthCodedPascalString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:520
    8.1916    2196840   8. MySQLReplication\BinaryDataReader\BinaryDataReader->readUIntBySize() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:196
    8.1916    2196840   9. MySQLReplication\BinaryDataReader\BinaryDataReader->readUInt16() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:214
    8.1916    2196872  10. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:135

Notice: Uninitialized string offset: 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php on line 503

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1927    2196904   6. MySQLReplication\Event\RowEvent\RowEvent->checkNull() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:302

Warning: unpack(): Type v: not enough input, need 2, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 135

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1935    2196904   6. MySQLReplication\Event\RowEvent\RowEvent->getString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:391
    8.1935    2196904   7. MySQLReplication\BinaryDataReader\BinaryDataReader->readLengthCodedPascalString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:520
    8.1935    2196904   8. MySQLReplication\BinaryDataReader\BinaryDataReader->readUIntBySize() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:196
    8.1935    2196904   9. MySQLReplication\BinaryDataReader\BinaryDataReader->readUInt16() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:214
    8.1935    2196904  10. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:135

Notice: Uninitialized string offset: 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php on line 503

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1947    2196936   6. MySQLReplication\Event\RowEvent\RowEvent->checkNull() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:302

Warning: unpack(): Type v: not enough input, need 2, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 135

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1955    2196936   6. MySQLReplication\Event\RowEvent\RowEvent->getString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:391
    8.1955    2196936   7. MySQLReplication\BinaryDataReader\BinaryDataReader->readLengthCodedPascalString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:520
    8.1955    2196936   8. MySQLReplication\BinaryDataReader\BinaryDataReader->readUIntBySize() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:196
    8.1955    2196936   9. MySQLReplication\BinaryDataReader\BinaryDataReader->readUInt16() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:214
    8.1955    2196936  10. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:135

Notice: Uninitialized string offset: 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php on line 503

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1976    2196968   6. MySQLReplication\Event\RowEvent\RowEvent->checkNull() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:302

Warning: unpack(): Type I: not enough input, need 4, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 257

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.1985    2196968   6. MySQLReplication\Event\RowEvent\RowEvent->getString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:446
    8.1986    2196968   7. MySQLReplication\BinaryDataReader\BinaryDataReader->readLengthCodedPascalString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:520
    8.1986    2196968   8. MySQLReplication\BinaryDataReader\BinaryDataReader->readUIntBySize() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:196
    8.1986    2196968   9. MySQLReplication\BinaryDataReader\BinaryDataReader->readUInt32() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:222
    8.1986    2196968  10. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:257

Warning: unpack(): Type C: not enough input, need 1, have 0 in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php on line 249

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.2003    2197216   6. MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderService->parseToString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:446
    8.2003    2197216   7. MySQLReplication\BinaryDataReader\BinaryDataReader->readUInt8() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/JsonBinaryDecoder/JsonBinaryDecoderService.php:59
    8.2003    2197216   8. unpack() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/BinaryDataReader/BinaryDataReader.php:249

Fatal error: Uncaught MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderException: Unknown JSON type:  in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/JsonBinaryDecoder/JsonBinaryDecoderService.php on line 364

MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderException: Unknown JSON type:  in /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/JsonBinaryDecoder/JsonBinaryDecoderService.php on line 364

Call Stack:
    0.0011     361648   1. {main}() /home/wwwroot/test//dump_event.php:0
    8.1256    2142512   2. MySQLReplication\MySQLReplicationFactory->binLogEvent() /home/wwwroot/test//dump_event.php:52
    8.1256    2142512   3. MySQLReplication\Event\Event->consume() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/MySQLReplicationFactory.php:131
    8.1258    2142768   4. MySQLReplication\Event\RowEvent\RowEvent->makeUpdateRowsDTO() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/Event.php:103
    8.1733    2196432   5. MySQLReplication\Event\RowEvent\RowEvent->getColumnData() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:892
    8.2003    2197216   6. MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderService->parseToString() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/Event/RowEvent/RowEvent.php:446
    8.2012    2197184   7. MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderService->parseJson() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/JsonBinaryDecoder/JsonBinaryDecoderService.php:59
    8.2013    2197184   8. MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderService->parseScalar() /home/wwwroot/test//vendor/krowinski/php-mysql-replication/src/MySQLReplication/JsonBinaryDecoder/JsonBinaryDecoderService.php:112
domyway commented 7 years ago

seems that big json text parse has some problem still .

Fatal error: Uncaught LengthException: The offset for the value in the JSON binary document is 39398, which is larger than the binary form of the JSON document (34277 bytes) in /Users/weizhao/lnmp/www/huajuan/app/hj_rep/vendor/krowinski/php-mysql-replication/src/MySQLReplication/JsonBinaryDecoder/JsonBinaryDecoderService.php on line 215

LengthException: The offset for the value in the JSON binary document is 39398, which is larger than the binary form of the JSON document (34277 bytes) in /Users/weizhao/lnmp/www/huajuan/app/hj_rep/vendor/krowinski/php-mysql-replication/src/MySQLReplication/JsonBinaryDecoder/JsonBinaryDecoderService.php on line 215
krowinski commented 7 years ago

@domyway tx for test cases, check now.

domyway commented 7 years ago
UPDATE `hj_ad` SET `ad_title` = '3' WHERE `hj_ad`.`id` = 5;   

above problem solved , but big json still parse error.

this is the test case:


CREATE TABLE `hj_feed_content` (
 `id` bigint(13) NOT NULL AUTO_INCREMENT,
 `feed_id` bigint(13) unsigned NOT NULL COMMENT '',
 `feed_content` json NOT NULL COMMENT '',
 `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
 `add_time` int(13) NOT NULL COMMENT '',
 `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COMMENT='feed'

INSERT INTO `hj_feed_content` (`id`, `feed_id`, `feed_content`, `is_del`, `add_time`, `last_update_time`) VALUES (NULL, '1', '{"sku": [1000139], "title": "this is the testing", "video": ["850"], "order_sn": ""}', '0', '1473070261', '2016-11-24 11:41:31')

execute sql :

UPDATE `hj_feed_content` SET `is_del` = '1' WHERE `hj_feed_content`.`id` = 1;

output the same fatal error above.

krowinski commented 7 years ago

@domyway antoher fix done (some day I will finish :))

domyway commented 7 years ago

Im testing! seems perfect~~~ :)

but I found another bug, dbName of Configuration seems not work. but databasesOnly works fine .

$config = [
        'user' => 'root',
        'ip' => '127.0.0.1',
        'password' => '1',
        'charset' => 'utf8mb4',
        'dbName' => 'wlg'
];

when I update huajuan.hj_ad or wlg.hj_ad , dumpEvent.php output the before and after value all the times

but this config works fine

$config = [
        'user' => 'root',
        'ip' => '127.0.0.1',
        'password' => '1',
        'charset' => 'utf8mb4',
        'databasesOnly' => ['wlg']
];
krowinski commented 7 years ago

cool :)

dbName its depreceted will be remove from Documentation and code tx