Skip to content
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

[LI-HOTFIX] Add logs when shrinkISR is blocked #471

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion core/src/main/scala/kafka/cluster/Partition.scala
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,17 @@ class Partition(val topicPartition: TopicPartition,
private def needsShrinkIsr(): Boolean = {
leaderLogIfLocal.exists { log =>
val outOfSyncReplicaIds = getOutOfSyncReplicas(replicaLagTimeMaxMs)
outOfSyncReplicaIds.nonEmpty && (inSyncReplicaIds -- outOfSyncReplicaIds).size >= log.config.minInSyncReplicas
if (outOfSyncReplicaIds.isEmpty) {
// Do not shrink ISR if there is no out of sync replicas
return false
}

if ((inSyncReplicaIds -- outOfSyncReplicaIds).size >= log.config.minInSyncReplicas) {
return true
} else {
info(s"Refuse to shrink ISR for partition ${topicPartition} to avoid underMinISR. Out of sync replicas: ${outOfSyncReplicaIds}.")
return false
}
}
}

Expand Down
Loading