-
Bug
-
Resolution: Done
-
Blocker
-
0.8.1.Final
-
- Start MySQL
- Start Debezium
- Issue a create table data(id int, primary key (id)) statement.
- Error ConnectException: Invalid default value will occur.
When creating a table in MySQL (5.7) with the following definition:
create table data(id int, primary key (id))
MySqlDdlParser#parseCreateDefinition will parse it as follows:
columns: { id INT NOT NULL DEFAULT VALUE NULL } primary key: [id] default charset: null
This causes the following error when handling DDL events:
Error while trying to run connector class 'io.debezium.connector.mysql.MySqlConnector' org.apache.kafka.connect.errors.ConnectException: Invalid default value at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:200) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:178) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:452) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1055) ~[mysql-binlog-connector-java-0.13.0.jar:0.13.0] at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:913) ~[mysql-binlog-connector-java-0.13.0.jar:0.13.0] at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:559) ~[mysql-binlog-connector-java-0.13.0.jar:0.13.0] at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:793) ~[mysql-binlog-connector-java-0.13.0.jar:0.13.0] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171] Caused by: org.apache.kafka.connect.errors.SchemaBuilderException: Invalid default value at org.apache.kafka.connect.data.SchemaBuilder.defaultValue(SchemaBuilder.java:131) ~[connect-api-1.1.0.jar:?] at io.debezium.relational.TableSchemaBuilder.addField(TableSchemaBuilder.java:307) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at io.debezium.relational.TableSchemaBuilder.lambda$create$0(TableSchemaBuilder.java:97) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_171] at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080) ~[?:1.8.0_171] at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080) ~[?:1.8.0_171] at io.debezium.relational.TableSchemaBuilder.create(TableSchemaBuilder.java:94) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at io.debezium.relational.RelationalDatabaseSchema.buildAndRegisterSchema(RelationalDatabaseSchema.java:112) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.MySqlSchema.lambda$applyDdl$3(MySqlSchema.java:361) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_171] at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:355) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:637) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:436) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] ... 5 more Caused by: org.apache.kafka.connect.errors.DataException: Invalid value: null used for required field: "null", schema type: INT32 at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:218) ~[connect-api-1.1.0.jar:?] at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:212) ~[connect-api-1.1.0.jar:?] at org.apache.kafka.connect.data.SchemaBuilder.defaultValue(SchemaBuilder.java:129) ~[connect-api-1.1.0.jar:?] at io.debezium.relational.TableSchemaBuilder.addField(TableSchemaBuilder.java:307) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at io.debezium.relational.TableSchemaBuilder.lambda$create$0(TableSchemaBuilder.java:97) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_171] at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080) ~[?:1.8.0_171] at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080) ~[?:1.8.0_171] at io.debezium.relational.TableSchemaBuilder.create(TableSchemaBuilder.java:94) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at io.debezium.relational.RelationalDatabaseSchema.buildAndRegisterSchema(RelationalDatabaseSchema.java:112) ~[debezium-core-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.MySqlSchema.lambda$applyDdl$3(MySqlSchema.java:361) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_171] at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:355) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:637) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:436) ~[debezium-connector-mysql-0.8.1.Final.jar:0.8.1.Final] ... 5 more