KAFKA-14386: Return TopicAssignment from the ReplicaPlacer#12892
KAFKA-14386: Return TopicAssignment from the ReplicaPlacer#12892jsancio merged 12 commits intoapache:trunkfrom
Conversation
15927cf to
2356f14
Compare
jsancio
left a comment
There was a problem hiding this comment.
Thanks for the changes @andymg3 .
Should we also improve the PartitionRegistration type to use a PartitionAssignment instead of int[] replicas?
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/PartitionAssignment.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/StripedReplicaPlacer.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/TopicAssignment.java
Outdated
Show resolved
Hide resolved
metadata/src/test/java/org/apache/kafka/controller/ClusterControlManagerTest.java
Outdated
Show resolved
Hide resolved
metadata/src/test/java/org/apache/kafka/controller/ClusterControlManagerTest.java
Outdated
Show resolved
Hide resolved
metadata/src/test/java/org/apache/kafka/metadata/placement/StripedReplicaPlacerTest.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/PartitionAssignment.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/TopicAssignment.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/PartitionAssignment.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/TopicAssignment.java
Outdated
Show resolved
Hide resolved
…ead of list of list of integers
2356f14 to
5f8622a
Compare
Thanks for the review @jsancio. As of now I dont see much benefit in changing that type. In What do you think? |
jsancio
left a comment
There was a problem hiding this comment.
There are quite a few places in the codebase that use the replicas field and in practice if we were to use PartitionAssignment all callers would mostly just call PartitionAssignment.replicas() anyways. So overall I don't see much benefit in introducing the type.
Sounds good.
metadata/src/test/java/org/apache/kafka/controller/ClusterControlManagerTest.java
Outdated
Show resolved
Hide resolved
metadata/src/test/java/org/apache/kafka/metadata/placement/StripedReplicaPlacerTest.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/TopicAssignment.java
Outdated
Show resolved
Hide resolved
metadata/src/main/java/org/apache/kafka/metadata/placement/PartitionAssignment.java
Outdated
Show resolved
Hide resolved
metadata/src/test/java/org/apache/kafka/metadata/placement/PartitionAssignmentTest.java
Show resolved
Hide resolved
This reverts commit 3b320b3.
) This changes the ReplicaPlacer interface to return a class instead of a list of list of integers. There are two reasons for the suggestion. First, as mentioned in the JIRA, it will make the interface, arguably, a bit more readable and understandable by explicitly modeling the idea of topic and partition. Second and more importantly, it makes the interface more extendable in the future. Right now it would be challenging to add more metadata to the response. Reviewers: José Armando García Sancio <jsancio@apache.org>
JIRA
https://issues.apache.org/jira/browse/KAFKA-14386
Summary
This changes the
ReplicaPlacerinterface to return a class instead of a list of list of integers. There are two reasons for the suggestion. First, as mentioned in the JIRA, it will make the interface, arguably, a bit more readable and understandable by explicitly modeling the idea of topic and partition. Second and more importantly, it makes the interface more extendable in the future. Right now it would be challenging to add more metadata to the response. By having classes, we can easily add fields to them without breaking/changing the interface. For example, in the CreatePartitions RPC we are adding partitions to an existing topic and we might want to add some metadata to response making it clear which partition the assignment starts at which could look something like:Committer Checklist (excluded from commit message)