-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-17578: Remove partitionRacks from TopicMetadata #17233
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrankYang0529 Thanks for working on this. I left a few high level comments to start with.
* @return The set of racks corresponding to the replicas of the topic's partition. | ||
* If the topic Id does not exist, an empty set is returned. | ||
*/ | ||
Set<String> racksForPartition(Uuid topicId, int partition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot remove this from the public interface. Let’s return an empty set for now.
@@ -27,14 +27,7 @@ | |||
{ "name": "TopicName", "versions": "0+", "type": "string", | |||
"about": "The topic name." }, | |||
{ "name": "NumPartitions", "versions": "0+", "type": "int32", | |||
"about": "The number of partitions of the topic." }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same. Unfortunately, we cannot remove fields because we released it. We must keep it. Let’s put a comment explaining that we don’t use it.
return new TopicMetadata( | ||
record.topicId(), | ||
record.topicName(), | ||
record.numPartitions(), | ||
partitionRacks); | ||
record.numPartitions()); | ||
} | ||
|
||
public static TopicMetadata fromRecord( | ||
ShareGroupPartitionMetadataValue.TopicMetadata record |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Not related to your changes but the indentation is incorrect here.
record.topicId(), | ||
record.topicName(), | ||
record.numPartitions(), | ||
partitionRacks); | ||
record.numPartitions()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ditto.
@@ -242,27 +242,6 @@ private static void assertApiMessageAndVersionEquals( | |||
assertEquals(expectedTopicMetadata.topicId(), actualTopicMetadata.topicId()); | |||
assertEquals(expectedTopicMetadata.topicName(), actualTopicMetadata.topicName()); | |||
assertEquals(expectedTopicMetadata.numPartitions(), actualTopicMetadata.numPartitions()); | |||
|
There was a problem hiding this comment.
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 keep this code if we keep the fields in the record.
60e0793
to
0bb615e
Compare
Hi @dajac, thanks for review and suggestion. I addressed all comments. However, both |
0bb615e
to
354b577
Compare
Hi @dajac, I fixed both |
@FrankYang0529 Thanks for the update. I am travelling today so I will review it on Monday. |
@FrankYang0529 There are a few conflicts. Could you please address them? |
354b577
to
9a7a620
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FrankYang0529 Thanks for the update. I left a few nits for consideration.
newSubscriptionMetadata.put(topicName, new TopicMetadata( | ||
topicImage.id(), | ||
topicImage.name(), | ||
topicImage.partitions().size(), | ||
partitionRacks) | ||
topicImage.partitions().size()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could you please put the last closing parenthesis on the next line?
newSubscriptionMetadata.put(topicName, new TopicMetadata(
topicImage.id(),
topicImage.name(),
topicImage.partitions().size()
));
return new TopicMetadata( | ||
record.topicId(), | ||
record.topicName(), | ||
record.numPartitions(), | ||
partitionRacks); | ||
record.numPartitions()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Ditto about the closing parenthesis.
partitionRacks); | ||
record.topicId(), | ||
record.topicName(), | ||
record.numPartitions()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ditto.
Signed-off-by: PoAn Yang <[email protected]>
9a7a620
to
1485824
Compare
Hi @dajac, thanks for the review. Updated it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
@FrankYang0529 Thanks for the patch. I just merged it. We need to work on another strategy to trigger rebalances based on rack changes. I have a few ideas. If you are interested, you could pick it up. |
Hi @dajac, I'm glad to handle it. Feel free to assign to me. Thank you 😄 |
Thank you. May I try it? |
The ModernGroup#subscribedTopicMetadata takes too much memory due to
partitionRacks
. This is not being used at the moment as the consumer protocol does not support rack aware assignments.A heap dump from a group with 500 members, 2K subscribed topic partitions shows 654,400 bytes used for partitionRacks. The rest of the ConsumerGroup object holds 822,860 bytes.
Committer Checklist (excluded from commit message)