Reputation: 3092
I have an enum field for status in my Avro schema in which the possible statuses currently are
PENDING
APPROVED
REJECTED
I want to add one more value in this enum “RESUBMIT”. Is this change backward compatible ?
Upvotes: 7
Views: 9034
Reputation: 1102
No, it is not. Here's why: If you are using this new schema to, let's say, emit events to Kafka, then all clients will try to deserialize the value. When event with new type will appear, there would be 2 cases:
So, no, this is not backward compatible.
update: You can probably avoid deserialization failure by specifying the default value for enum (available in Avro version 1.10.2+)
Upvotes: 1
Reputation: 879
As per https://docs.confluent.io/platform/current/schema-registry/avro.html
- BACKWARD compatibility means that consumers using the new schema can read data produced with the last schema
- FORWARD compatibility means that data produced with a new schema can be read by consumers using the last schema
Going by that definition/terminology above, the change is BACKWARD compatible i.e. all your consumers need to be upgraded first. But not FORWARD compatible since the consumer with the old schema cant deserialize this.
Correcting my previous answer above.
There is a way to add a new enum value in a compatible way
Upvotes: 8
Reputation: 191743
I don't think it is, but you are welcome to use the Schema Registry API to verify compatbility
https://docs.confluent.io/current/schema-registry/develop/api.html#id1
Upvotes: 1