Kafka:启用日志压缩时,带有空键的消息会发生什么? [英] Kafka: What happens to message with null key when log compaction is enabled?

查看:19
本文介绍了Kafka:启用日志压缩时,带有空键的消息会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当启用日志压缩时,带有空键的消息会发生什么?带有空键的消息是否被压缩?

What happens to message with null key when log compaction is enabled? Are messages with a null key compacted?

推荐答案

在当前版本中会发生以下情况:

In current version what happens is this:

"当前当用户向日志压缩主题发送空键时,代理会返回 CorruptRecordException,这是一个可重试的异常.因此,生产者会不断重试,直到重试次数用完或 request.timeout.ms 到期并最终抛出 TimeoutException."

"Currently when a user sends a null key to a log compacted topic, the broker returns CorruptRecordException, which is a retriable exception. As such, the producer keeps retrying until retries are exhausted or request.timeout.ms expires and eventually throws a TimeoutException."

Jira KIP-135 这有点令人困惑.

将来如果来自 KIP-135 的更清洁的解决方案(正如 @Ran Lupvoich 指出的那样仍在讨论中)被接受,另一种行为应该如下:

In the future if the cleaner solution from KIP-135 (still under discussion as @Ran Lupvoich pointed out) get accepted another behavior should be the following:

当您尝试生成空键来记录压缩主题时,Kafka 应该返回一个新的错误类型 INVALID_KEY

When you try to produce null key to log compacted topic, Kafka should return a new error type INVALID_KEY

这篇关于Kafka:启用日志压缩时,带有空键的消息会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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