Schema Registry Incompatible

Viewed 173

How to check previous schemas registered in Registry?

I'm trying to register but I am getting "Schema being registered is incompatible with an earlier schema for subject" exception

3 Answers

You can try the following

  • Command to get all versions of the previously registered schemas

SchemaRegistryURL/subjects/topicname-value/versions

  • Command to get a specific version of all previously registered Schemas

SchemaRegistryURL/subjects/topicname-value/versions/version

Schema Compatibility option might not set it correctly, in which case you can reset the Compatibility using the following command and try re-registering your schema.

curl -k -X PUT -H "Content-Type:application/vnd.schemaregistry.v1+json" --data '{"compatibility": "NONE"}' SchemaRegistryURL/config/topic-value

From https://docs.confluent.io/platform/current/schema-registry/avro.html#summary

Compatibility

Transitive compatibility checking is important once you have more than two versions of a schema for a given subject. If compatibility is configured as transitive, then it checks compatibility of a new schema against all previously registered schemas; otherwise, it checks compatibility of a new schema only against the latest schema.

For example, if there are three schemas for a subject that change in order X-2, X-1, and X then:

transitive: ensures compatibility between X-2 <==> X-1 and X-1 <==> X and X-2 <==> X

non-transitive: ensures compatibility between X-2 <==> X-1 and X-1 <==> X, but not necessarily X-2 <==> X

The Confluent Schema Registry default compatibility type BACKWARD is non-transitive, which means that it’s not BACKWARD_TRANSITIVE. As a result, new schemas are checked for compatibility only against the latest schema.

BACKWARD: (default) consumers using X-2 can read data written by producers X-1

BACKWARD_TRANSITIVE: consumers using X-2 can read data written by producers using X-1, and X

FORWARD: consumers using X-1 can read data written by producers using X-2

FORWARD_TRANSITIVE: consumers using X-1 or X can read data written by producers using X-2

FULL: the new schema is forward and backward compatible with the latest registered schema

FULL_TRANSITIVE: the new schema is forward and backward compatible with all previously registered schemas

NONE: schema compatibility checks are disabled

Related