Kafka block.on.buffer.full 默认值

Kafka block.on.buffer.full default value

我正在查看 kafka(0.9.0.1) 生产者配置,文档中的 属性 block.on.buffer.full 说:

When our memory buffer is exhausted we must either stop accepting new records (block) or throw errors. By default this setting is true and we block, however in some scenarios blocking is not desirable and it is better to immediately give an error. Setting this to false will accomplish that: the producer will throw a BufferExhaustedException if a recrord is sent and the buffer space is full.

所以理论上它应该是正确的,但在同一文档 (http://kafka.apache.org/documentation.html) 中,table 有一个名为 "default" 的列指出默认值实际上是错误的。

哪一个是正确的?

默认值为 false。

这是最新版本的生产者默认 configuration

你说的对,代码和javadoc也不对,看ProducerConfig class:

javadoc 说,它默认为 true。

 @Deprecated
    public static final String BLOCK_ON_BUFFER_FULL_CONFIG = "block.on.buffer.full";
    private static final String BLOCK_ON_BUFFER_FULL_DOC = "When our memory buffer is exhausted we must either stop accepting new records (block) or throw errors. **By default this setting is true** and we block, however in some scenarios blocking is not desirable and it is better to immediately give an error. Setting this to <code>false</code> will accomplish that: the producer will throw a BufferExhaustedException if a recrord is sent and the buffer space is full.";

但是,代码将其设置为 false :)。

 .define(BLOCK_ON_BUFFER_FULL_CONFIG, Type.BOOLEAN, **false,** Importance.LOW, BLOCK_ON_BUFFER_FULL_DOC)

无论如何,它已被弃用,不应使用。