cmccabe commented on code in PR #17604:
URL: https://github.com/apache/kafka/pull/17604#discussion_r1821602548
##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -1136,6 +1139,34 @@ ControllerResult<AlterPartitionResponseData>
alterPartition(
return ControllerResult.of(records, response);
}
+ /**
+ * Validates that a batch of topics will create less than {@value
MAX_PARTITIONS_PER_BATCH}. Exceeding this number of topics per batch
+ * has led to out-of-memory exceptions. We use this validation to fail
earlier to avoid allocating the memory.
+ * This validation assumes that all the topics in the batch are valid and
can be created.
+ *
+ * @param request a batch of topics to create.
+ * @param defaultNumPartitions default number of partitions to assign if
unspecified.
+ * @throws PolicyViolationException if total number of partitions exceeds
{@value MAX_PARTITIONS_PER_BATCH}.
+ */
+ static void
validateEstimatedTotalNumberOfPartitions(CreateTopicsRequestData request, int
defaultNumPartitions) {
Review Comment:
can you remove the "estimated" from the function name? since we're
calculating the exact number (not an estimate...)
--
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]