融合架构注册表:架构ID删除 [英] Confluent Schema Registry : Schema ID deletion

查看:832
本文介绍了融合架构注册表:架构ID删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发中,并试图删除主题的架构,因为更改与旧架构不兼容.

We are in development and trying to delete the schema for a topic , since the change in incompatible with older schema.

我们删除了架构/主题,并尝试使用相同的主题名称创建新架构,并且架构已成功创建.

We deleted the schema / subject and tried creating the new schema under the same subject name and schema was successfully created.

但是,当我们运行该应用程序时,它仍然指向相同的架构ID.

However, when we run the application, it is still pointing to same schema ID.

旧模式ID(针对主题"topic1"):51

Older schema ID ( for subject 'topic1") : 51

新的模式ID(针对主题"topic1"):52

New schema ID ( for subject 'topic1') : 52

应用程序失败,并出现反序列化消息的错误

Application fails with an error deserializing the message

    at org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:736)
Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 51
Caused by: org.apache.avro.AvroTypeException: Found string, expecting union
    at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:292)
    at org.apache.avro.io.parsing.Parser.advance(Parser.java:88)
    at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:267)
    at org.apache.avro.generic.GenericDatumReader.readWithoutConversion(GenericDatumRea

root @ bas:/#curl -k https://schemaregistry:443/subjects/topic1/versions/latest

{"subject":"topic1","version":15,"id":52,"schema":"{\"type\":\"record\",\"name\":\"TopicOutputOutput\",\"namespace\":\"com.sagar.avsc\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"client\",\"type\":{\"type\":\"record\",\"name\":\"ClientObject\",\"fields\":[{\"name\":\"name\",\"type\":[\"null\",\"string\"]},{\"name\":\"client_id\",\"type\":[\"null\",\"long\"]},{\"name\":\"source_system_id\",\"type\":[\"null\",\"long\"]}]}},  ... 

更改: {\"name \":\"client_id \",\"type \":[\"null \",\"long \"]}

您可以看到模式ID为52,但应用程序正在尝试使用较早的模式ID(51),该模式ID与我们发送的数据不兼容

You can see that the schema ID is 52 but application is trying older schema ID (51), which is incompatible with the data we are sending

root@bas:/#  curl -k https://schemaregistry:443/schemas/ids/52
{"schema":"{\"type\":\"record\",\"name\":\"TopicOutputOutput\",\"namespace\":\"com.sagar.avsc\",\"fields\":[{\"name\":\"id\",\"type\":\"long\"},{\"name\":\"client\",\"type\":{\"type\":\"record\",\"name\":\"ClientObject\",\"fields\":[{\"name\":\"name\",\"type\":[\"null\",\"string\"]},{\"name\":\"client_id\",\"type\":[\"null\",\"long\"]},{\"name\":\"source_system_id\",

更改: {\"name \":\"name \",\"type \":[\"null \",\"string \"]}

为什么应用程序仍引用旧的模式ID?有没有办法删除模式ID?

why is application still referring to older schema ID ? And is there a way to delete Schema ID ?

推荐答案

您可以对/subjects/:name/versions/:version

但是,模式ID 51仍然是主题中的 ,在这些特定的消息到期之前,或者在压缩主题的情况下被墓碑化,无法从那里将其删除.

However, schema ID 51 is still in the topic, and there is no way to delete it from there until those particular messages expire, or are tombstoned in the case of compacted topics.

如果架构不兼容,那么我将检查注册表的配置,因为默认情况下,它不允许向后不兼容的更改.

And if the schemas are not compatible, then I would check the configs of the registry because by default, it doesn't allow backwards incompatible changes.

这篇关于融合架构注册表:架构ID删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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