DL1231 commented on code in PR #14594:
URL: https://github.com/apache/kafka/pull/14594#discussion_r2606499739
##########
core/src/main/scala/kafka/cluster/Partition.scala:
##########
@@ -359,10 +361,14 @@ class Partition(val topicPartition: TopicPartition,
// a false positive under min isr check, it has to check the
leaderReplicaIdOpt again. Though it can still be affected
// by ABA problems when leader->follower->leader, but it should be good
enough for a metric.
def isUnderMinIsr: Boolean = {
- leaderLogIfLocal.exists { partitionState.isr.size <
_.config.minInSyncReplicas } && isLeader
+ leaderLogIfLocal.exists{partitionState.isr.size < effectiveMinIsr(_) } &&
isLeader
}
- def isAtMinIsr: Boolean = leaderLogIfLocal.exists { partitionState.isr.size
== _.config.minInSyncReplicas }
+ private def effectiveMinIsr(leaderLog: UnifiedLog): Int = {
+ leaderLog.config.minInSyncReplicas.min(remoteReplicasMap.size + 1)
Review Comment:
Restricting `min.insync.replicas` to not exceed the replica count may have
more practical significance, but it could also lead to some compatibility
issues.
When modifying `min.insync.replicas` or adjusting the replica count, we
could check whether the change is valid. If it is not, a warning log could be
printed to remind users that such an invalid configuration will be prohibited
in a future release (e.g., version 5.0). What do you think of this approach?
--
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]