MINOR: Remove unused mkMapOfPartitionRacks method (#19797)

The mkMapOfPartitionRacks in ServerSideAssignorBenchmark.java was
introduced in 8013657f5d,  and the one in
GroupCoordinatorRecordHelpersTest.java was introduced in
3709901c9e.

Both have not been used since bb97d63d41.

Reviewers: Ken Huang <s7133700@gmail.com>, Chia-Ping Tsai
 <chia7712@gmail.com>
This commit is contained in:
Jhen-Yung Hsu 2025-05-26 02:54:17 +08:00 committed by GitHub
parent bcda92b5b9
commit 651f86b77e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 32 deletions

View File

@ -62,7 +62,6 @@ import org.junit.jupiter.params.provider.MethodSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
@ -898,21 +897,4 @@ public class GroupCoordinatorRecordHelpersTest {
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;
}
}

View File

@ -215,7 +215,7 @@ public class ClientSideAssignorBenchmark {
for (int i = 0; i < numberOfPartitions; i++) {
Node[] replicas = new Node[3];
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;
replicas[j] = nodes.get(nodeIndex);
}

View File

@ -48,7 +48,6 @@ import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -186,18 +185,6 @@ public class ServerSideAssignorBenchmark {
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() {
GroupAssignment initialAssignment = partitionAssignor.assign(groupSpec, subscribedTopicDescriber);
Map<String, MemberAssignment> members = initialAssignment.members();