在 Kafka 中读取未提交

Read Uncommitted in Kafka

我对 Kafka 中的isolation.level= read_uncommited有些困惑。

https://www.confluent.io/blog/transactions-apache-kafka/博客中有关于read_uncommited的解释:

In short: Kafka guarantees that a consumer will eventually deliver only non-transactional messages or committed transactional messages. It will withhold messages from open transactions and filter out messages from aborted transactions.

但是在官方的 Kafka 文档中 https://kafka.apache.org/documentation/#consumerconfigs_isolation.level 它解释说:

If set to read_uncommitted (the default), consumer.poll() will return all messages, even transactional messages which have been aborted. Non-transactional messages will be returned unconditionally in either mode.

那么哪一个是正确的?

两者都符合事实。从confluent博客复制的总结被误解了

请注意,您复制的文本位于 阅读交易消息 部分下。文本试图解释当交易或 read_committed 消费者正在读取数据时:

  • 来自中止事务的消息被过滤掉
  • 来自打开的事务的消息被保留(如果事务被提交,它们最终将被提供给应用程序,或者如果事务被中止,它们将被过滤掉)