gpt4 book ai didi

java - kafka log-compaction消费数据

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:24:26 25 4
gpt4 key购买 nike

我正在阅读最新版本的 kafka 中的日志压缩,我很好奇这对消费者有何影响。消费者是否像以前一样工作,或者是否有一个新的流程来获取所有最新值?

对于“标准”Kafka 主题,我使用消费者组来维护指向最新值的指针。但是,如果 Kafka 基于键而不是时间来保存值,我想知道消费者群体将如何运作?

最佳答案

它不会影响消费者的工作方式。如果你只对每个键的最新值感兴趣并阅读整个主题,你可能仍然会看到一个键的“重复项”(如果不是所有重复项都被消除,或者在上次压缩运行后写入新消息)因此你只关心关于每个键的最新值。

关于消费者组:当主题被压缩时,有效偏移量范围内会出现“漏洞”。当您定期讨论某个主题时,您会自动跳过这些主题。

来自 https://kafka.apache.org/documentation.html#design_compactionbasics

Note also that all offsets remain valid positions in the log, even if the message with that offset has been compacted away; in this case this position is indistinguishable from the next highest offset that does appear in the log. For example, in the picture above the offsets 36, 37, and 38 are all equivalent positions and a read beginning at any of these offsets would return a message set beginning with 38.

关于java - kafka log-compaction消费数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39019170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com