Chia-Ping Tsai created KAFKA-17525:
--------------------------------------

             Summary: Convert the UnknownServerException to 
InvalidRequestException when altering client-metrics config at runtime
                 Key: KAFKA-17525
                 URL: https://issues.apache.org/jira/browse/KAFKA-17525
             Project: Kafka
          Issue Type: Improvement
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


see following test:

{code:bash}
chia7712@fedora:~/project/kafka$ bin/kafka-configs.sh --bootstrap-server 
192.168.1.149:22222 --alter --entity-type client-metrics --entity-name test 
--add-config interval.ms=bbb
Error while executing config command with args '--bootstrap-server 
192.168.1.149:22222 --alter --entity-type client-metrics --entity-name test 
--add-config interval.ms=bbb'
java.util.concurrent.ExecutionException: 
org.apache.kafka.common.errors.UnknownServerException: The server experienced 
an unexpected error when processing the request.
        at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
        at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
        at 
org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:180)
        at 
kafka.admin.ConfigCommand$.alterResourceConfig(ConfigCommand.scala:581)
        at kafka.admin.ConfigCommand$.alterConfig(ConfigCommand.scala:449)
        at kafka.admin.ConfigCommand$.processCommand(ConfigCommand.scala:351)
        at kafka.admin.ConfigCommand$.main(ConfigCommand.scala:100)
        at kafka.admin.ConfigCommand.main(ConfigCommand.scala)
Caused by: org.apache.kafka.common.errors.UnknownServerException: The server 
experienced an unexpected error when processing the request.

{code}

By contrast, `topic` resource can handle the such error and then return 
`InvalidRequestException`
```bash
chia7712@fedora:~/project/kafka$ bin/kafka-configs.sh --bootstrap-server 
192.168.1.149:22222 --alter --topic chia --add-config flush.ms=aaa
Error while executing config command with args '--bootstrap-server 
192.168.1.149:22222 --alter --topic chia --add-config flush.ms=aaa'
java.util.concurrent.ExecutionException: 
org.apache.kafka.common.errors.InvalidConfigurationException: Invalid value aaa 
for configuration flush.ms: Not a number of type LONG
        at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
        at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
        at 
org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:180)
        at 
kafka.admin.ConfigCommand$.alterResourceConfig(ConfigCommand.scala:581)
        at kafka.admin.ConfigCommand$.alterConfig(ConfigCommand.scala:371)
        at kafka.admin.ConfigCommand$.processCommand(ConfigCommand.scala:351)
        at kafka.admin.ConfigCommand$.main(ConfigCommand.scala:100)
        at kafka.admin.ConfigCommand.main(ConfigCommand.scala)
Caused by: org.apache.kafka.common.errors.InvalidConfigurationException: 
Invalid value aaa for configuration flush.ms: Not a number of type LONG
```




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to