Skip to content

Commit 42e530c

Browse files
milindledenhill
authored andcommitted
Remove warning for allow.auto.create.topics with producer
Also improves the documentation around this property. This solves the following problem: The property "allow.auto.create.topics" is supposed to be a consumer property, but we are setting it (and it is affecting the behaviour of) both the consumer and producer. It gives a warning if we change it in the producer, but works nevertheless. (the default value for the producer is true) One of the effects is that if a user is using their producer as an adminclient, a call to get metadata for a topic might create that topic, and if the user specifies allow.auto.create.topics, then they get a warning. Unfortunately, we even recommend using a producer with the above setting (see INTRODUCTION.md). A knock on effect is that both the go and python clients use a producer internally for their adminclients so the user has to either live with a call to GetMetadata creating topics, or with the warning. The java client only allows this property to be set on the consumer, which makes it more confusing.
1 parent 47db428 commit 42e530c

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ configuration property.
4242
* Bundled zlib upgraded to version 1.2.13.
4343
* Added `on_broker_state_change()` interceptor
4444
* The C++ API no longer returns strings by const value, which enables better move optimization in callers.
45+
* Setting `allow.auto.create.topics` will no longer give a warning if used by a producer, since that is an expected use case.
46+
Improvement in documentation for this property.
4547

4648

4749
## Fixes

CONFIGURATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ api.version.request | * | true, false | true
5757
api.version.request.timeout.ms | * | 1 .. 300000 | 10000 | low | Timeout for broker API version requests. <br>*Type: integer*
5858
api.version.fallback.ms | * | 0 .. 604800000 | 0 | medium | Dictates how long the `broker.version.fallback` fallback is used in the case the ApiVersionRequest fails. **NOTE**: The ApiVersionRequest is only issued when a new connection to the broker is made (such as after an upgrade). <br>*Type: integer*
5959
broker.version.fallback | * | | 0.10.0 | medium | Older broker versions (before 0.10.0) provide no way for a client to query for supported protocol features (ApiVersionRequest, see `api.version.request`) making it impossible for the client to know what features it may use. As a workaround a user may set this property to the expected broker version and the client will automatically adjust its feature set accordingly if the ApiVersionRequest fails (or is disabled). The fallback broker version will be used for `api.version.fallback.ms`. Valid values are: 0.9.0, 0.8.2, 0.8.1, 0.8.0. Any other value >= 0.10, such as 0.10.2.1, enables ApiVersionRequests. <br>*Type: string*
60+
allow.auto.create.topics | * | true, false | false | low | Allow automatic topic creation on the broker when subscribing to or assigning non-existent topics. The broker must also be configured with `auto.create.topics.enable=true` for this configuration to take effect. Note: the default value (true) for the producer is different from the default value (false) for the consumer. Further, the consumer default value is different from the Java consumer (true), and this property is not supported by the Java producer. Requires broker version >= 0.11.0.0, for older broker versions only the broker configuration applies. <br>*Type: boolean*
6061
security.protocol | * | plaintext, ssl, sasl_plaintext, sasl_ssl | plaintext | high | Protocol used to communicate with brokers. <br>*Type: enum value*
6162
ssl.cipher.suites | * | | | low | A cipher suite is a named combination of authentication, encryption, MAC and key exchange algorithm used to negotiate the security settings for a network connection using TLS or SSL network protocol. See manual page for `ciphers(1)` and `SSL_CTX_set_cipher_list(3). <br>*Type: string*
6263
ssl.curves.list | * | | | low | The supported-curves extension in the TLS ClientHello message specifies the curves (standard/named, or 'explicit' GF(2^k) or GF(p)) the client is willing to have the server use. See manual page for `SSL_CTX_set1_curves_list(3)`. OpenSSL >= 1.0.2 required. <br>*Type: string*
@@ -128,7 +129,6 @@ rebalance_cb | C | |
128129
offset_commit_cb | C | | | low | Offset commit result propagation callback. (set with rd_kafka_conf_set_offset_commit_cb()) <br>*Type: see dedicated API*
129130
enable.partition.eof | C | true, false | false | low | Emit RD_KAFKA_RESP_ERR__PARTITION_EOF event whenever the consumer reaches the end of a partition. <br>*Type: boolean*
130131
check.crcs | C | true, false | false | medium | Verify CRC32 of consumed messages, ensuring no on-the-wire or on-disk corruption to the messages occurred. This check comes at slightly increased CPU usage. <br>*Type: boolean*
131-
allow.auto.create.topics | C | true, false | false | low | Allow automatic topic creation on the broker when subscribing to or assigning non-existent topics. The broker must also be configured with `auto.create.topics.enable=true` for this configuraiton to take effect. Note: The default value (false) is different from the Java consumer (true). Requires broker version >= 0.11.0.0, for older broker versions only the broker configuration applies. <br>*Type: boolean*
132132
client.rack | * | | | low | A rack identifier for this client. This can be any string value which indicates where this client is physically located. It corresponds with the broker config `broker.rack`. <br>*Type: string*
133133
transactional.id | P | | | high | Enables the transactional producer. The transactional.id is used to identify the same transactional producer instance across process restarts. It allows the producer to guarantee that transactions corresponding to earlier instances of the same producer have been finalized prior to starting any new transactions, and that any zombie instances are fenced off. If no transactional.id is provided, then the producer is limited to idempotent delivery (if enable.idempotence is set). Requires broker version >= 0.11.0. <br>*Type: string*
134134
transaction.timeout.ms | P | 1000 .. 2147483647 | 60000 | medium | The maximum amount of time in milliseconds that the transaction coordinator will wait for a transaction status update from the producer before proactively aborting the ongoing transaction. If this value is larger than the `transaction.max.timeout.ms` setting in the broker, the init_transactions() call will fail with ERR_INVALID_TRANSACTION_TIMEOUT. The transaction timeout automatically adjusts `message.timeout.ms` and `socket.timeout.ms`, unless explicitly configured in which case they must not exceed the transaction timeout (`socket.timeout.ms` must be at least 100ms lower than `transaction.timeout.ms`). This is also the default timeout value if no timeout (-1) is supplied to the transactional API methods. <br>*Type: integer*

src/rdkafka_conf.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,20 @@ static const struct rd_kafka_property rd_kafka_properties[] = {
732732
"Any other value >= 0.10, such as 0.10.2.1, "
733733
"enables ApiVersionRequests.",
734734
.sdef = "0.10.0", .validate = rd_kafka_conf_validate_broker_version},
735+
{_RK_GLOBAL, "allow.auto.create.topics", _RK_C_BOOL,
736+
_RK(allow_auto_create_topics),
737+
"Allow automatic topic creation on the broker when subscribing to "
738+
"or assigning non-existent topics. "
739+
"The broker must also be configured with "
740+
"`auto.create.topics.enable=true` for this configuration to "
741+
"take effect. "
742+
"Note: the default value (true) for the producer is "
743+
"different from the default value (false) for the consumer. "
744+
"Further, the consumer default value is different from the Java "
745+
"consumer (true), and this property is not supported by the Java "
746+
"producer. Requires broker version >= 0.11.0.0, for older broker "
747+
"versions only the broker configuration applies.",
748+
0, 1, 0},
735749

736750
/* Security related global properties */
737751
{_RK_GLOBAL | _RK_HIGH, "security.protocol", _RK_C_S2I,
@@ -1254,18 +1268,6 @@ static const struct rd_kafka_property rd_kafka_properties[] = {
12541268
"on-disk corruption to the messages occurred. This check comes "
12551269
"at slightly increased CPU usage.",
12561270
0, 1, 0},
1257-
{_RK_GLOBAL | _RK_CONSUMER, "allow.auto.create.topics", _RK_C_BOOL,
1258-
_RK(allow_auto_create_topics),
1259-
"Allow automatic topic creation on the broker when subscribing to "
1260-
"or assigning non-existent topics. "
1261-
"The broker must also be configured with "
1262-
"`auto.create.topics.enable=true` for this configuraiton to "
1263-
"take effect. "
1264-
"Note: The default value (false) is different from the "
1265-
"Java consumer (true). "
1266-
"Requires broker version >= 0.11.0.0, for older broker versions "
1267-
"only the broker configuration applies.",
1268-
0, 1, 0},
12691271
{_RK_GLOBAL, "client.rack", _RK_C_KSTR, _RK(client_rack),
12701272
"A rack identifier for this client. This can be any string value "
12711273
"which indicates where this client is physically located. It "

0 commit comments

Comments
 (0)