You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Jerry Cai (Jira)" <ji...@apache.org> on 2024/10/09 23:54:00 UTC
[jira] [Created] (KAFKA-17755) AbstractPartitionAssignor can not enable Rack Aware Assignment
Jerry Cai created KAFKA-17755:
---------------------------------
Summary: AbstractPartitionAssignor can not enable Rack Aware Assignment
Key: KAFKA-17755
URL: https://issues.apache.org/jira/browse/KAFKA-17755
Project: Kafka
Issue Type: Bug
Components: consumer
Affects Versions: 3.8.0
Reporter: Jerry Cai
During my local test and debug, I noticed that the below logical is in correct, it need to change
from !racksPerPartition.values().stream().allMatch(partitionRacks::equals) to racksPerPartition.values().stream().allMatch(partitionRacks::equals)
current logical
{code:java}
protected boolean useRackAwareAssignment(Set<String> consumerRacks, Set<String> partitionRacks, Map<TopicPartition, Set<String>> racksPerPartition) {
if (consumerRacks.isEmpty() || Collections.disjoint(consumerRacks, partitionRacks))
return false;
else if (preferRackAwareLogic)
return true;
else {
return !racksPerPartition.values().stream().allMatch(partitionRacks::equals);
}
}
{code}
expected logical
{code:java}
protected boolean useRackAwareAssignment(Set<String> consumerRacks, Set<String> partitionRacks, Map<TopicPartition, Set<String>> racksPerPartition) {
if (consumerRacks.isEmpty() || Collections.disjoint(consumerRacks, partitionRacks))
return false;
else if (preferRackAwareLogic)
return true;
else {
return racksPerPartition.values().stream().allMatch(partitionRacks::equals);
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)