Repository: kafka
Updated Branches:
  refs/heads/trunk 25fa39d5e -> a788c65f0


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


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/a788c65f
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/a788c65f
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/a788c65f

Branch: refs/heads/trunk
Commit: a788c65f02ae493abc27fe63c6d181e6a9b8edfe
Parents: 25fa39d
Author: Mayuresh Gharat <[email protected]>
Authored: Wed Jan 6 14:16:56 2016 -0800
Committer: Jun Rao <[email protected]>
Committed: Wed Jan 6 14:16:56 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/a788c65f/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))

Reply via email to