Hi all,
We are currently trying to upgrade some Debezium mysql connectors from v1.4.1 to ideally v1.8 but are having trouble upgrading to anything past 1.4.2.
The release notes for 1.5.0.Alpha1 [1] mention breaking changes in the Avro schema for the schema change topic and have upgrade notes stating that the Avro schema compatibility must be set to FORWARD for new table schemas to be registered.
In our testing we're seeing new table schemas still failing to register in schema registry even after changing the compatibility mode to FORWARD. We were also able to reproduce this with the mysql Avro tutorials in debezium-examples [2] with the following steps
# Start connect and a debezium connector on 1.4export DEBEZIUM_VERSION=1.4docker-compose -f docker-compose-mysql-avro-worker.yaml upcurl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://localhost:8083/connectors/ -d @register-mysql.json# Stop the connector and connect worker for upgradecurl -i -X DELETE -H "Accept:application/json" -H "Content-Type:application/json" http://localhost:8083/connectors/inventory-connectordocker-compose -f docker-compose-mysql-avro-worker.yaml stop connect# Change schema-registry to FORWARD compatibility (All schemas for convenience, but should only need dbserver1-value)curl -XPUT localhost:8081/config -d '{"compatibility":"FORWARD"}' -H 'Content-Type: application/json'# Upgrade to a newer debezium version export DEBEZIUM_VERSION=1.5docker-compose -f docker-compose-mysql-avro-worker.yaml up --no-deps connect# Perform a DDL changedocker-compose -f docker-compose-mysql.yaml exec mysql bash -c 'mysql -u $MYSQL_USER -p$MYSQL_PASSWORD inventory -e "ALTER TABLE customers ADD COLUMN test VARCHAR(255) DEFAULT NULL;"'# Start the connector againcurl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://localhost:8083/connectors/ -d @register-mysql.jsonAt this point we are seeing the following exception in the connect logs:
Caused by: org.apache.kafka.common.config.ConfigException: Invalid value org.apache.kafka.common.errors.InvalidConfigurationException: Schema being registered is incompatible with an earlier schema for subject "dbserver1-value"; error code: 409 for configuration Failed to access Avro data from topic dbserver1 :
at io.confluent.connect.avro.AvroConverter.fromConnectData(AvroConverter.java:98)
at org.apache.kafka.connect.storage.Converter.fromConnectData(Converter.java:63)
at org.apache.kafka.connect.runtime.WorkerSourceTask.lambda$convertTransformedRecord$2(WorkerSourceTask.java:314)
at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:156)
at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:190)
... 11 more
If I diff the v1.4 avro schema against the v1.5+ avro schema I see the expected "tableChanges" additions, but I'm also seeing a change in type from string to a union of string|null in two fields that seem to be causing this schema incompatibility
(left is v1.5, right is v1.4)
{ {
"name": "databaseName", "name": "databaseName",
"type": [ | "type": "string"
"null", <
"string" <
], <
"default": null <
}, },
{ {
"name": "ddl", "name": "ddl",
"type": [ | "type": "string"
"null", <
"string" <
], <
"default": null <
}, },
Is there any guidance on how best we could proceed here? Are we missing a step in this upgrade path? One thought was to disable compatibility checks fully on this topic, allow the new schema to get registered and then attempt to turn on FORWARD compatibility again but we are unsure if this is a plausible or desired approach