Skip to content

KAFKA-14702: Extend server side assignor to support rack aware replica placement#13998

Closed
rreddy-22 wants to merge 60 commits into
apache:trunkfrom
rreddy-22:rreddy-22/Rack-Assignor-Interface-Changes
Closed

KAFKA-14702: Extend server side assignor to support rack aware replica placement#13998
rreddy-22 wants to merge 60 commits into
apache:trunkfrom
rreddy-22:rreddy-22/Rack-Assignor-Interface-Changes

Conversation

@rreddy-22

@rreddy-22 rreddy-22 commented Jul 12, 2023

Copy link
Copy Markdown
Contributor

We want to make the assignors rack aware and in order to obtain and provide the rack Information the following interface modifications were made:-

  1. TopicDescriber - Interface passed to the assignor to obtain topic and partition metadata
  2. AssignmentTopicDescriber - Implementation of the interface above
  3. Add partitionRack field to the ConsumerGroupPartitionMetadataValue.json
  4. TopicMetadata has a new attribute Map<Integer, Set> partitionRackInfo

rreddy-22 and others added 30 commits March 23, 2023 13:02
…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
@dajac dajac changed the title KIP-848: Rack awareness interface changes for assignors KAFKA-14702: Extend server side assignor to support rack aware replica placement Jul 20, 2023
@dajac dajac added the KIP-848 The Next Generation of the Consumer Rebalance Protocol label Jul 20, 2023

@dajac dajac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I wonder if SubscribedTopicDescriber would be better based on the javadoc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: topicIds -> topic id.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@dajac dajac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rreddy-22 Thanks for the update. I left some comments. Note that the build is read. Could you also look into this?

Comment thread checkstyle/import-control.xml Outdated
<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"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that we can remove this, isn't it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep correct we don't need it now that we don't have any classes in it

Comment thread checkstyle/suppressions.xml
{ "name": "NumPartitions", "versions": "0+", "type": "int32",
"about": "The number of partitions of the topic." }
"about": "The number of partitions of the topic." },
{ "name": "PartitionRacks",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Partitions instead of PartitionRacks?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it from partitionRackInfo to partitionRacks based on the previous comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

named it partitionMetadata as well

topics.put(topicMetadata.id(), new AssignmentTopicMetadata(topicMetadata.numPartitions()))
topicMetadataMap.put(
topicMetadata.id(),
new PartitionMetadata(topicMetadata.partitionRacks())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me create a Uuid -> PartitionMetadata map in TopicMetadata itself and then pass it directly

Comment thread reviewers.py
* @return Number of partitions associated with the topic.
*/
public int numPartitions() {
return partitionsWithRacks.size();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that the map won't have anything for partitions without racks so this must be wrong, isn't it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, must've forgotten to change this file after reversing the changes to remove numPartitions, sorry

@dajac

dajac commented Jul 26, 2023

Copy link
Copy Markdown
Member

Replaced by #14099.

@dajac dajac closed this Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

KIP-848 The Next Generation of the Consumer Rebalance Protocol

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants