mchades opened a new issue, #14576:
URL: https://github.com/apache/gravitino/issues/14576

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   Creating a Kafka topic with `partition-count=0` or a value below `-1` 
returns HTTP 500 instead of 400. Kafka rejects the request with 
`InvalidPartitionsException`, but `KafkaCatalogOperations#createTopic` wraps 
that exception in a generic `RuntimeException`.
   
   ### Error message and/or stacktrace
   
   ```text
   RuntimeException: Failed to create topic in Kafka ...: Number of partitions 
must be larger than 0.
   Caused by: ExecutionException: InvalidPartitionsException: Number of 
partitions must be larger than 0.
   ```
   
   ### How to reproduce
   
   1. Create a Kafka messaging catalog connected to a Kafka broker.
   2. POST to 
`/api/metalakes/{metalake}/catalogs/{catalog}/schemas/default/topics` with:
   
   ```json
   
{"name":"invalid_partitions","properties":{"partition-count":"0","replication-factor":"1"}}
   ```
   
   3. Observe HTTP 500 instead of 400. Repeat with `partition-count=-2`.
   
   ### Additional context
   
   `partition-count=-1` is a valid Kafka sentinel for the broker default and 
should continue to succeed. The fix should handle `InvalidPartitionsException` 
as an argument error, matching the existing `InvalidReplicationFactorException` 
handling.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to