muralibasani commented on code in PR #23895:
URL: https://github.com/apache/kafka/pull/23895#discussion_r4424441285
##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -2480,12 +2480,12 @@ private void
listReassigningTopic(ListPartitionReassignmentsResponseData respons
}
// Visible to test.
- int getTopicEffectiveMinIsr(String topicName) {
+ int getEffectiveMinIsr(String topicName, PartitionRegistration partition) {
String minIsrConfig = configurationControl.getTopicConfig(topicName,
MIN_IN_SYNC_REPLICAS_CONFIG).value();
int currentMinIsr = Integer.parseInt(minIsrConfig);
- Uuid topicId = topicsByName.get(topicName);
- int replicationFactor =
topics.get(topicId).parts.get(0).replicas.length;
- return Math.min(currentMinIsr, replicationFactor);
+ // Must match Partition#effectiveMinIsr on the broker. Partitions of
the same topic can
+ // have different replication factors, so use this partition's replica
count.
+ return Math.min(currentMinIsr, partition.replicas.length);
Review Comment:
How about passing the raw min.insync.replicas into the builder and apply
Math.min, because the comment mentions "Must match ..."
With this approach, all the 7 call sites would be fixed.
wdyt ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]