-
Bug
-
Resolution: Done
-
Major
-
None
-
None
When changing a column's type, the old default value is still kept in the meta-model, causing an exception when exporting the schema to Connect. For example:
CREATE TABLE customers ( id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, customer_type enum('b2c','b2b') NOT NULL default 'b2c' ) AUTO_INCREMENT=1001;
alter table customers change customer_type customer_kind int;
This will cause the following exception:
connect_1 | org.apache.kafka.connect.errors.ConnectException: Invalid default value connect_1 | at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:200) connect_1 | at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:178) connect_1 | at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:452) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1055) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:913) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:559) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:793) connect_1 | at java.lang.Thread.run(Thread.java:748) connect_1 | Caused by: org.apache.kafka.connect.errors.SchemaBuilderException: Invalid default value connect_1 | at org.apache.kafka.connect.data.SchemaBuilder.defaultValue(SchemaBuilder.java:131) connect_1 | at io.debezium.relational.TableSchemaBuilder.addField(TableSchemaBuilder.java:307) connect_1 | at io.debezium.relational.TableSchemaBuilder.lambda$create$0(TableSchemaBuilder.java:103) connect_1 | at java.util.ArrayList.forEach(ArrayList.java:1257) connect_1 | at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080) connect_1 | at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080) connect_1 | at io.debezium.relational.TableSchemaBuilder.create(TableSchemaBuilder.java:94) connect_1 | at io.debezium.connector.mysql.MySqlSchema.lambda$applyDdl$3(MySqlSchema.java:406) connect_1 | at java.lang.Iterable.forEach(Iterable.java:75) connect_1 | at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:401) connect_1 | at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:637) connect_1 | at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:436) connect_1 | ... 5 more connect_1 | Caused by: org.apache.kafka.connect.errors.DataException: Invalid Java object for schema type INT32: class java.lang.String for field: "null" connect_1 | at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:242) connect_1 | at org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:212) connect_1 | at org.apache.kafka.connect.data.SchemaBuilder.defaultValue(SchemaBuilder.java:129) connect_1 | ... 16 more
- relates to
-
DBZ-7251 Length value is not removed when changing a column's type
- Closed