/** * Add new partitions to the Kafka topic. * * @param zkUtils ZkUtils class to use to increase replication factor. * @param topic The topic to apply the change. * @param topicMetadata Topic metadata stored in Zookeeper. * @param partitionCount The target partition count of the topic. */ private void maybeIncreaseTopicPartitionCount(ZkUtils zkUtils, String topic, MetadataResponse.TopicMetadata topicMetadata, int partitionCount) { if (partitionCount > topicMetadata.partitionMetadata().size()) { if (!ensureTopicNotUnderPartitionReassignment(zkUtils, topic)) { LOG.warn("There are ongoing partition reassignments for topic {}, skip checking its partition count.", topic); return; } AdminUtils.addPartitions(zkUtils, topic, partitionCount, "", true, RackAwareMode.Safe$.MODULE$); LOG.info("Kafka topic " + topic + " now has " + partitionCount + " partitions."); } }
/** * Invokes {@link AdminUtils#addPartitions(ZkUtils, String, int, String, boolean, RackAwareMode)}. * * @param zkUtils zkUtils * @param topic topic * @param partitions partitions */ public void addKafkaPartition(ZkUtils zkUtils, String topic, Integer partitions) { AdminUtils.addPartitions(zkUtils, topic, partitions, "", true, RackAwareMode.Enforced$.MODULE$); } }
public void invokeAddPartitions(ZkUtils zkUtils, String topic, int numPartitions, String replicaAssignmentStr, boolean checkBrokerAvailable) { AdminUtils.addPartitions(zkUtils, topic, numPartitions, replicaAssignmentStr, checkBrokerAvailable, null); }
AdminUtils.addPartitions(zkUtils, topic, partitions, "", true, RackAwareMode.Enforced$.MODULE$); } catch (ZkException e) { throw new AdminOperationException("Unable to add partitions to topic: " + topic, e);
AdminUtils.addPartitions( zkUtils, topic,