@InterfaceStability.Evolving public class NewPartitions extends Object
Admin.createPartitions(Map). The API of this class is evolving, see Admin for details.| Modifier and Type | Method and Description |
|---|---|
List<List<Integer>> | assignments()The replica assignments for the new partitions, or null if the assignment will be done by the controller. |
static NewPartitions | increaseTo(int totalCount)Increase the partition count for a topic to the given totalCount. |
static NewPartitions | increaseTo(int totalCount, List<List<Integer>> newAssignments)Increase the partition count for a topic to the given totalCount assigning the new partitions according to the given newAssignments. |
String | toString() |
int | totalCount()The total number of partitions after the operation succeeds. |
public static NewPartitions increaseTo(int totalCount)
totalCount. The assignment of new replicas to brokers will be decided by the broker.totalCount - The total number of partitions after the operation succeeds.public static NewPartitions increaseTo(int totalCount, List<List<Integer>> newAssignments)
Increase the partition count for a topic to the given totalCount assigning the new partitions according to the given newAssignments. The length of the given newAssignments should equal totalCount - oldCount, since the assignment of existing partitions are not changed. Each inner list of newAssignments should 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 NewPartition constructed 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.
totalCount - The total number of partitions after the operation succeeds.newAssignments - The replica assignments for the new partitions.public int totalCount()
public List<List<Integer>> assignments()