unknowntpo commented on code in PR #23895:
URL: https://github.com/apache/kafka/pull/23895#discussion_r4558912312


##########
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:
   Good idea, done. Callers now pass the raw min.insync.replicas, and the 
builder uses the replicas of its own partition.



-- 
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]

Reply via email to