josefk31 commented on code in PR #17604: URL: https://github.com/apache/kafka/pull/17604#discussion_r1817399193
########## metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java: ########## @@ -605,6 +605,17 @@ ControllerResult<CreateTopicsResponseData> createTopics( Map<ConfigResource, Map<String, Entry<OpType, String>>> configChanges = computeConfigChanges(topicErrors, request.topics()); + int totalPartitions = 0; + for (CreatableTopic topic: request.topics()) { + // Negative numPartitions are possible, so exclude them from the total. + if (topic.numPartitions() > 0) { + totalPartitions += topic.numPartitions(); + } + } + if (totalPartitions > 10_000) { + throw new PolicyViolationException("Number of partitions across all topics should be less than 10000"); Review Comment: I'm not `100%` sure that a `PolicyViolationException` is the most appropriate error as IUUC the [error message](https://github.com/apache/kafka/blob/ab0df20489a8d6079cc576f4d9f7326db4b333c9/clients/src/main/java/org/apache/kafka/common/protocol/Errors.java#L269) returned to the user will be: > Request parameters do not satisfy the configured policy. Unless we want to allow this to be configurable by users... -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org