There are some optional metadata defined. They are listed in the table
@ref Table_table_map_event_optional_metadata. Optional metadata fields
follow null_bits. Whether binlogging an optional metadata is decided by the
server. The order is not defined, so they can be binlogged in any order.
Debezium error log:Trace: org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped. at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:50) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$ReaderThreadLifecycleListener.onCommunicationFailure(MySqlStreamingChangeEventSource.java:1233) at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:980) at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:599) at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:857) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: io.debezium.DebeziumException: Failed to deserialize data of EventHeaderV4{timestamp=1655558927000, eventType=TABLE_MAP, serverId=1, headerLength=19, dataLength=104, nextPosition=7697425, flags=0} at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.wrap(MySqlStreamingChangeEventSource.java:1188) ... 5 more Caused by: com.github.shyiko.mysql.binlog.event.deserialization.EventDataDeserializationException: Failed to deserialize data of EventHeaderV4{timestamp=1655558927000, eventType=TABLE_MAP, serverId=1, headerLength=19, dataLength=104, nextPosition=7697425, flags=0} at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeEventData(EventDeserializer.java:309) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeTableMapEventData(EventDeserializer.java:281) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.nextEvent(EventDeserializer.java:228) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$1.nextEvent(MySqlStreamingChangeEventSource.java:230) at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:952) ... 3 more Caused by: java.io.EOFException: Failed to read next byte from position 15 at com.github.shyiko.mysql.binlog.io.ByteArrayInputStream.read(ByteArrayInputStream.java:213) at com.github.shyiko.mysql.binlog.io.ByteArrayInputStream.readPackedNumber(ByteArrayInputStream.java:173) at com.github.shyiko.mysql.binlog.io.ByteArrayInputStream.readPackedInteger(ByteArrayInputStream.java:152) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventMetadataDeserializer.readIntegerPairs(TableMapEventMetadataDeserializer.java:164) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventMetadataDeserializer.deserialize(TableMapEventMetadataDeserializer.java:86) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventDataDeserializer.deserialize(TableMapEventDataDeserializer.java:47) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventDataDeserializer.deserialize(TableMapEventDataDeserializer.java:27) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeEventData(EventDeserializer.java:303) ... 7 more
The optional table metadata is not sorted, when reading the type UNKNOWN_METADATA_FIELD_TYPE not in the end position cause this issue.
Refer mysql rows_event code: https://github.com/mysql/mysql-server/blob/8.0/libbinlogevents/include/rows_event.h#L185
Related sql statement:
create table workdb.
debezium_all_types(
idint(11) not null auto_increment,
tinyitinyint(4) default '0',
smallismallint(6) default '0',
mediumimediumint(9) default '0',
bigibigint(20) default '0',
ffloat default '0.001',
doudouble default '0',
dedecimal(36,2) default '0.00',
cchar(10) collate utf8_bin default 'char',
vvarchar(255) collate utf8_bin default 'varchar',
tetext collate utf8_bin,
tinyttinytext collate utf8_bin,
mediumtmediumtext collate utf8_bin,
longtlongtext collate utf8_bin,
bblob,
tinybtinyblob,
mediumbmediumblob,
longblongblob,
ddate default null,
ttime not null default '18:30:30',
dtdatetime default null,
tstimestamp not null default current_timestamp,
yyear(4) default '2000', primary key (
id) ) engine=innodb auto_increment=1 default charset=utf8 collate=utf8_bin;
INSERT INTO workdb.debezium_all_types_2 (tinyi,mediumi,bigi,f,dou,de,c,v,te,tinyt,mediumt,longt,b,tinyb,mediumb,longb,d,t,dt,ts,y) VALUES (127, 8388607, 225073858, 1.17549435138, 2.225073858, 12345678910111213141516.17, 'Maria', 'Maria carchar', 'Maria text', 'Maria tiny text', 'Maria medium text', 'Maria long text', 65534, 65534, 16777214, 4294967294, now(), now(), now(), now(), '2022');Debezium error log:
Trace: org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped. at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:50) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$ReaderThreadLifecycleListener.onCommunicationFailure(MySqlStreamingChangeEventSource.java:1233) at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:980) at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:599) at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:857) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: io.debezium.DebeziumException: Failed to deserialize data of EventHeaderV4{timestamp=1655558927000, eventType=TABLE_MAP, serverId=1, headerLength=19, dataLength=104, nextPosition=7697425, flags=0} at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.wrap(MySqlStreamingChangeEventSource.java:1188) ... 5 more Caused by: com.github.shyiko.mysql.binlog.event.deserialization.EventDataDeserializationException: Failed to deserialize data of EventHeaderV4{timestamp=1655558927000, eventType=TABLE_MAP, serverId=1, headerLength=19, dataLength=104, nextPosition=7697425, flags=0} at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeEventData(EventDeserializer.java:309) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeTableMapEventData(EventDeserializer.java:281) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.nextEvent(EventDeserializer.java:228) at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$1.nextEvent(MySqlStreamingChangeEventSource.java:230) at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:952) ... 3 more Caused by: java.io.EOFException: Failed to read next byte from position 15 at com.github.shyiko.mysql.binlog.io.ByteArrayInputStream.read(ByteArrayInputStream.java:213) at com.github.shyiko.mysql.binlog.io.ByteArrayInputStream.readPackedNumber(ByteArrayInputStream.java:173) at com.github.shyiko.mysql.binlog.io.ByteArrayInputStream.readPackedInteger(ByteArrayInputStream.java:152) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventMetadataDeserializer.readIntegerPairs(TableMapEventMetadataDeserializer.java:164) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventMetadataDeserializer.deserialize(TableMapEventMetadataDeserializer.java:86) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventDataDeserializer.deserialize(TableMapEventDataDeserializer.java:47) at com.github.shyiko.mysql.binlog.event.deserialization.TableMapEventDataDeserializer.deserialize(TableMapEventDataDeserializer.java:27) at com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.deserializeEventData(EventDeserializer.java:303) ... 7 more