-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-14702: Extend server side assignor to support rack aware replica placement #13998
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
Changes from 45 commits
e8d3607
3df3460
7410529
3b6e65e
4b321aa
b4041a7
7352cbb
57b94ca
5065109
100a04e
73c7fdc
68d53b3
48a9822
dcb8198
9f3a423
a925b02
7d16269
7369db3
918d262
288fa1f
a1bdb58
0737c8d
3d92645
309cc61
7fd7794
dffad67
ef81486
0cd618a
d33bbfa
2d50c27
e56ded2
28ab298
5550e49
feb12ec
cc88822
1c2475b
e1a0325
931bcf7
e9ebc4f
9815d6d
ce540f9
478488e
c50f3bd
f68471a
579bb94
4511683
faafed2
22f2df0
6650ea5
061dac7
57b9a62
a30a534
6fe72df
c0b464c
a39e76f
2d40125
81f1ccd
1c955b5
5a93532
71f8488
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.kafka.coordinator.group.assignor; | ||
|
|
||
| import org.apache.kafka.common.Uuid; | ||
| import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * The assignment topic describer is used by the {@link PartitionAssignor} | ||
| * to obtain topic and partition metadata of subscribed topics. | ||
| * | ||
| * The interface is kept in an internal module until KIP-848 is fully | ||
| * implemented and ready to be released. | ||
| */ | ||
| @InterfaceStability.Unstable | ||
| public interface AssignmentTopicDescriber { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I wonder if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
| /** | ||
| * Returns a set of subscribed topicIds. | ||
| * | ||
| * @return Set of topicIds corresponding to the subscribed topics. | ||
| */ | ||
| Set<Uuid> subscribedTopicIds(); | ||
|
|
||
| /** | ||
| * Number of partitions for the given topicId. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| * | ||
| * @param topicId Uuid corresponding to the topic. | ||
| * @return The number of partitions corresponding to the given topicId. | ||
| * If the topicId doesn't exist return 0; | ||
| */ | ||
| int numPartitions(Uuid topicId); | ||
|
|
||
| /** | ||
| * Returns all the racks associated with the replicas for the given partition. | ||
| * | ||
| * @param topicId Uuid corresponding to the partition's topic. | ||
| * @param partition Partition number within topic. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Let's use partition id or index instead of number.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. partition number is used a lot throughout the kafka code and I thought it's easier to understand than Id even though they're interchangeable.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is it? I don't remember seeing it. I usually see partition index or id.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah haha I'll make it partition Id |
||
| * @return The set of racks corresponding to the replicas of the topics partition. | ||
| * If the topicId doesn't exist return an empty set; | ||
| */ | ||
| 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.
I suppose that we can remove this, isn't 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.
yep correct we don't need it now that we don't have any classes in it