Avro模式:向现有模式添加枚举值是否向后兼容? [英] Avro schema : is adding an enum value to existing schema backward compatible?

查看:30
本文介绍了Avro模式:向现有模式添加枚举值是否向后兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Avro模式中有一个用于状态的枚举字段,当前可能的状态为

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 ?

推荐答案

不,不是.原因如下:假设您使用这种新模式向Kafka发出事件,那么所有客户端都将尝试反序列化该值.当出现具有新类型的事件时,将出现2种情况:

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:

  1. 具有新架构的客户端将成功反序列化
  2. 具有架构的
  3. 客户端将无法反序列化,因为它们在枚举中没有这样的价值

所以,不,这不是向后兼容的.

So, no, this is not backward compatible.

这篇关于Avro模式:向现有模式添加枚举值是否向后兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆