[
https://issues.apache.org/jira/browse/KAFKA-15136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17739485#comment-17739485
]
Xiaobing Fang commented on KAFKA-15136:
---------------------------------------
Can anyone give some opinions?
> The inspection of field allowAutoTopicCreation field in MetadataRequest is
> unreasonable
> ---------------------------------------------------------------------------------------
>
> Key: KAFKA-15136
> URL: https://issues.apache.org/jira/browse/KAFKA-15136
> Project: Kafka
> Issue Type: Improvement
> Components: clients
> Reporter: Xiaobing Fang
> Priority: Major
>
>
> {code:java}
> if (!data.allowAutoTopicCreation() && version < 4)
> throw new UnsupportedVersionException("MetadataRequest versions older
> than 4 don't support the " +
> "allowAutoTopicCreation field"); {code}
>
> Background:
> Based on my understanding, the code in MetadataRequest is intended to ignore
> the allowAutoTopicCreation field when version≤4. However, if kafka server is
> configured with "auto.create.topics.enable"=false and the client sets
> allowAutoTopicCreation=false, UnsupportedVersionExceptionwill be thrown,
> which is not expected.
>
> Issues:
> # `KafkaAdminClient#handleDescribeTopicsByNames()` throws an exception when
> sending MetadataRequest to a lower version server, making it unusable.
> # MetadataRequestTest avoids this issue by setting
> `allowAutoTopicCreation=true` in tests for version≤4, but this is not
> reasonable. And the comments in
> [testAutoTopicCreation|https://github.com/apache/kafka/blob/1f4cbc5d53259031123b6e9e6bb9a5bbe1e084e8/core/src/test/scala/unit/kafka/server/MetadataRequestTest.scala#L146]
> may also be problematic.
>
> Solution:
> # Remove the checking code in MetadataRequest.
> # Add a field `hasSetAllowAutoTopicCreation` in MetadataRequest. Only throw
> an exception when `version≤4` and `hasSetAllowAutoTopicCreation=true`,
> without considering the value of allowAutoTopicCreation field.
>
> If there is indeed an issue, I can work on fixing it. Looking forward to your
> reply.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)