Class NewPartitions
- java.lang.Object
-
- org.apache.kafka.clients.admin.NewPartitions
-
@Evolving public class NewPartitions extends java.lang.Object
Describes new partitions for a particular topic in a call toAdmin.createPartitions(Map). The API of this class is evolving, seeAdminfor details.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.util.List<java.lang.Integer>>assignments()The replica assignments for the new partitions, or null if the assignment will be done by the controller.static NewPartitionsincreaseTo(int totalCount)Increase the partition count for a topic to the giventotalCount.static NewPartitionsincreaseTo(int totalCount, java.util.List<java.util.List<java.lang.Integer>> newAssignments)Increase the partition count for a topic to the giventotalCountassigning the new partitions according to the givennewAssignments.java.lang.StringtoString()inttotalCount()The total number of partitions after the operation succeeds.
-
-
-
Method Detail
-
increaseTo
public static NewPartitions increaseTo(int totalCount)
Increase the partition count for a topic to the giventotalCount. The assignment of new replicas to brokers will be decided by the broker.- Parameters:
totalCount- The total number of partitions after the operation succeeds.
-
increaseTo
public static NewPartitions increaseTo(int totalCount, java.util.List<java.util.List<java.lang.Integer>> newAssignments)
Increase the partition count for a topic to the given
totalCountassigning the new partitions according to the givennewAssignments. The length of the givennewAssignmentsshould equaltotalCount - oldCount, since the assignment of existing partitions are not changed. Each inner list ofnewAssignmentsshould have a length equal to the topic's replication factor. The first broker id in each inner list is the "preferred replica".For example, suppose a topic currently has a replication factor of 2, and has 3 partitions. The number of partitions can be increased to 6 using a
NewPartitionconstructed like this:NewPartitions.increaseTo(6, asList(asList(1, 2), asList(2, 3), asList(3, 1)))In this example partition 3's preferred leader will be broker 1, partition 4's preferred leader will be broker 2 and partition 5's preferred leader will be broker 3.
- Parameters:
totalCount- The total number of partitions after the operation succeeds.newAssignments- The replica assignments for the new partitions.
-
totalCount
public int totalCount()
The total number of partitions after the operation succeeds.
-
assignments
public java.util.List<java.util.List<java.lang.Integer>> assignments()
The replica assignments for the new partitions, or null if the assignment will be done by the controller.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-