private void checkPartitionQuota(List<CreatePartitionsTopic> topics, List<CreatePartitionsTopicResult> results) {
        int quota = configurationControl.partitionCountQuota();
        Set<String> topicNameSet = topics.stream().map(CreatePartitionsTopic::name).collect(Collectors.toSet());
        int partitionCount = this.topics.values()
            .stream()
            .filter(info -> !topicNameSet.contains(info.name))
            .mapToInt(info -> info.parts.size()).sum();
        int partitionAdditionCount = topics.stream().mapToInt(CreatePartitionsTopic::count).sum();
        if (partitionCount + partitionAdditionCount > quota) {
            for (CreatePartitionsTopic topic : topics) {
                results.add(new CreatePartitionsTopicResult().
                    setName(topic.name()).
                    setErrorCode(Errors.THROTTLING_QUOTA_EXCEEDED.code()).
                    setErrorMessage("Partition count exceeds the quota, current quota is " + quota));
            }
        }
    }
Attempt to elect a preferred leader for all topic partitions which have a leader that is not the preferred replica.

The response() method in the return object is true if this method returned without electing all possible preferred replicas.
The quorum controller should reschedule this operation immediately if it is true.

@return All of the election records and if there may be more available preferred replicas to elect as leader
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java