Repository: kafka Updated Branches: refs/heads/0.9.0 870cd3607 -> 4ea380331
KAFKA-2937; Disable the leaderIsr check if the topic is to be deleted. The check was implemented in KAFKA-340 : If we are shutting down a broker when the ISR of a partition includes only that broker, we could lose some messages that have been previously committed. For clean shutdown, we need to guarantee that there is at least 1 other broker in ISR after the broker is shut down. When we are deleting the topic, this check can be avoided. Author: Mayuresh Gharat <[email protected]> Reviewers: Dong Lin <[email protected]>, Rajini Sivaram <[email protected]>, Jun Rao <[email protected]> Closes #729 from MayureshGharat/kafka-2937 (cherry picked from commit a788c65f02ae493abc27fe63c6d181e6a9b8edfe) Signed-off-by: Jun Rao <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/4ea38033 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/4ea38033 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/4ea38033 Branch: refs/heads/0.9.0 Commit: 4ea3803317c8f997a70a3472bd4576213f2ee979 Parents: 870cd36 Author: Mayuresh Gharat <[email protected]> Authored: Wed Jan 6 14:16:56 2016 -0800 Committer: Jun Rao <[email protected]> Committed: Wed Jan 6 14:17:10 2016 -0800 ---------------------------------------------------------------------- core/src/main/scala/kafka/controller/ReplicaStateMachine.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/4ea38033/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala index 32ed288..8bb9099 100755 --- a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala +++ b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala @@ -265,7 +265,7 @@ class ReplicaStateMachine(controller: KafkaController) extends Logging { case None => true } - if (leaderAndIsrIsEmpty) + if (leaderAndIsrIsEmpty && !controller.deleteTopicManager.isPartitionToBeDeleted(topicAndPartition)) throw new StateChangeFailedException( "Failed to change state of replica %d for partition %s since the leader and isr path in zookeeper is empty" .format(replicaId, topicAndPartition))
