mirror of https://github.com/apache/kafka.git
MINOR: Remove unused mkMapOfPartitionRacks method (#19797)
The mkMapOfPartitionRacks in ServerSideAssignorBenchmark.java was introduced in8013657f5d
, and the one in GroupCoordinatorRecordHelpersTest.java was introduced in3709901c9e
. Both have not been used sincebb97d63d41
. Reviewers: Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
bcda92b5b9
commit
651f86b77e
|
@ -62,7 +62,6 @@ import org.junit.jupiter.params.provider.MethodSource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -898,21 +897,4 @@ public class GroupCoordinatorRecordHelpersTest {
|
||||||
10
|
10
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a map of partitions to racks for testing.
|
|
||||||
*
|
|
||||||
* @param numPartitions The number of partitions for the topic.
|
|
||||||
*
|
|
||||||
* For testing purposes, the following criteria are used:
|
|
||||||
* - Number of replicas for each partition: 2
|
|
||||||
* - Number of racks available to the cluster: 4
|
|
||||||
*/
|
|
||||||
public static Map<Integer, Set<String>> mkMapOfPartitionRacks(int numPartitions) {
|
|
||||||
Map<Integer, Set<String>> partitionRacks = new HashMap<>(numPartitions);
|
|
||||||
for (int i = 0; i < numPartitions; i++) {
|
|
||||||
partitionRacks.put(i, new HashSet<>(Arrays.asList("rack" + i % 4, "rack" + (i + 1) % 4)));
|
|
||||||
}
|
|
||||||
return partitionRacks;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ public class ClientSideAssignorBenchmark {
|
||||||
for (int i = 0; i < numberOfPartitions; i++) {
|
for (int i = 0; i < numberOfPartitions; i++) {
|
||||||
Node[] replicas = new Node[3];
|
Node[] replicas = new Node[3];
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
// Assign nodes based on partition number to mimic mkMapOfPartitionRacks logic.
|
// Assign nodes based on partition number.
|
||||||
int nodeIndex = (i + j) % NUMBER_OF_RACKS;
|
int nodeIndex = (i + j) % NUMBER_OF_RACKS;
|
||||||
replicas[j] = nodes.get(nodeIndex);
|
replicas[j] = nodes.get(nodeIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ import org.openjdk.jmh.annotations.State;
|
||||||
import org.openjdk.jmh.annotations.Threads;
|
import org.openjdk.jmh.annotations.Threads;
|
||||||
import org.openjdk.jmh.annotations.Warmup;
|
import org.openjdk.jmh.annotations.Warmup;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -186,18 +185,6 @@ public class ServerSideAssignorBenchmark {
|
||||||
return isRackAware ? Optional.of("rack" + memberIndex % NUMBER_OF_RACKS) : Optional.empty();
|
return isRackAware ? Optional.of("rack" + memberIndex % NUMBER_OF_RACKS) : Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<Integer, Set<String>> mkMapOfPartitionRacks(int numPartitions) {
|
|
||||||
Map<Integer, Set<String>> partitionRacks = new HashMap<>(numPartitions);
|
|
||||||
for (int i = 0; i < numPartitions; i++) {
|
|
||||||
partitionRacks.put(i, new HashSet<>(Arrays.asList(
|
|
||||||
"rack" + i % NUMBER_OF_RACKS,
|
|
||||||
"rack" + (i + 1) % NUMBER_OF_RACKS,
|
|
||||||
"rack" + (i + 2) % NUMBER_OF_RACKS
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
return partitionRacks;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void simulateIncrementalRebalance() {
|
private void simulateIncrementalRebalance() {
|
||||||
GroupAssignment initialAssignment = partitionAssignor.assign(groupSpec, subscribedTopicDescriber);
|
GroupAssignment initialAssignment = partitionAssignor.assign(groupSpec, subscribedTopicDescriber);
|
||||||
Map<String, MemberAssignment> members = initialAssignment.members();
|
Map<String, MemberAssignment> members = initialAssignment.members();
|
||||||
|
|
Loading…
Reference in New Issue