KAFKA-14702: Extend server side assignor to support rack aware replica placement#13998
KAFKA-14702: Extend server side assignor to support rack aware replica placement#13998rreddy-22 wants to merge 60 commits into
Conversation
… TopicIdToPartition data structure
…ccording to PR comments
…ava doc for getter methods
…ForMember, addressed PR comments, changed Map.Entry to Map.forEach etc.
…dy-22/KAFKA-14514 # Conflicts: # group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/AssignmentMemberSpec.java # group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/GroupAssignment.java # group-coordinator/src/main/java/org/apache/kafka/coordinator/group/assignor/MemberAssignment.java
…ss to handle topic and cluster images and added an AbstractPartitionAssignor
…on to the assignor, modified tests to incorporate changes
dajac
left a comment
There was a problem hiding this comment.
@rreddy-22 Thanks for the PR. I made a pass on the non-test files and left some comments/questions.
| * implemented and ready to be released. | ||
| */ | ||
| @InterfaceStability.Unstable | ||
| public interface AssignmentTopicDescriber { |
There was a problem hiding this comment.
nit: I wonder if SubscribedTopicDescriber would be better based on the javadoc.
There was a problem hiding this comment.
Yeah I named it this way cause I was just wondering if it'd be more uniform with assignmentSpec but I'll change it cause I agree
| Set<Uuid> subscribedTopicIds(); | ||
|
|
||
| /** | ||
| * Number of partitions for the given topicId. |
There was a problem hiding this comment.
It says topicId singular already, did we want a space between topic and Id
| @@ -29,7 +29,27 @@ | |||
| { "name": "TopicName", "versions": "0+", "type": "string", | |||
| "about": "The topic name." }, | |||
| { "name": "NumPartitions", "versions": "0+", "type": "int32", | |||
There was a problem hiding this comment.
Do we still need this field? I suppose that it depends on whether you plan to store partition metadata for partitions without racks or not.
There was a problem hiding this comment.
I think we shouldn't store the racks if they aren't available, I just changed it to remove numPartitions but I'll change it back now
…e-Changes' into rreddy-22/Rack-Assignor-Interface-Changes
dajac
left a comment
There was a problem hiding this comment.
@rreddy-22 Thanks for the update. I left some comments. Note that the build is read. Could you also look into this?
| <allow pkg="org.apache.kafka.common.utils" /> | ||
| <allow pkg="org.apache.kafka.common.errors" exact-match="true" /> | ||
| <allow pkg="org.apache.kafka.common.memory" /> | ||
| <allow pkg="org.apache.kafka.coordinator.group.common"/> |
There was a problem hiding this comment.
I suppose that we can remove this, isn't it?
There was a problem hiding this comment.
yep correct we don't need it now that we don't have any classes in it
| { "name": "NumPartitions", "versions": "0+", "type": "int32", | ||
| "about": "The number of partitions of the topic." } | ||
| "about": "The number of partitions of the topic." }, | ||
| { "name": "PartitionRacks", |
There was a problem hiding this comment.
nit: Partitions instead of PartitionRacks?
There was a problem hiding this comment.
I changed it from partitionRackInfo to partitionRacks based on the previous comment
There was a problem hiding this comment.
named it partitionMetadata as well
| topics.put(topicMetadata.id(), new AssignmentTopicMetadata(topicMetadata.numPartitions())) | ||
| topicMetadataMap.put( | ||
| topicMetadata.id(), | ||
| new PartitionMetadata(topicMetadata.partitionRacks()) |
There was a problem hiding this comment.
I am confused by the usage of PartitionMetadata only here. I think that this should be used in subscription metadata as well or not at all. It does not make sense to only use it here, right? Our goal is to avoid having to copy anything.
There was a problem hiding this comment.
Let me create a Uuid -> PartitionMetadata map in TopicMetadata itself and then pass it directly
| * @return Number of partitions associated with the topic. | ||
| */ | ||
| public int numPartitions() { | ||
| return partitionsWithRacks.size(); |
There was a problem hiding this comment.
My understanding is that the map won't have anything for partitions without racks so this must be wrong, isn't it?
There was a problem hiding this comment.
yes, must've forgotten to change this file after reversing the changes to remove numPartitions, sorry
…m:rreddy-22/kafka-rreddy into rreddy-22/Rack-Assignor-Interface-Changes
…picMetadata, PR comments
|
Replaced by #14099. |
We want to make the assignors rack aware and in order to obtain and provide the rack Information the following interface modifications were made:-