Repository: kafka Updated Branches: refs/heads/trunk 10abe858b -> cf03f349c
KAFKA-3761; Remove BrokerState "RunningAsController" The reasons to remove it are: 1. It's currently broken. The purpose of the [JIRA](https://issues.apache.org/jira/browse/KAFKA-3761) was to report that the RunningAsController state gets overwritten back to "RunningAsBroker". 2. It's not a useful state. a. If clients want to use this metric to know whether a broker is ready to receive requests or not, they do not care whether or not the broker is the controller b. there is already a separate boolean property, KafkaController.isActive which contains this information. Author: Roger Hoover <[email protected]> Reviewers: Grant Henke <[email protected]>, Ismael Juma <[email protected]> Closes #1437 from theduderog/KAFKA-3761-broker-state Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/cf03f349 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/cf03f349 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/cf03f349 Branch: refs/heads/trunk Commit: cf03f349caa92592ec42c7864b7f9d9ef21fee94 Parents: 10abe85 Author: Roger Hoover <[email protected]> Authored: Wed Jun 29 22:58:45 2016 +0200 Committer: Ismael Juma <[email protected]> Committed: Wed Jun 29 22:58:45 2016 +0200 ---------------------------------------------------------------------- .../scala/kafka/controller/KafkaController.scala | 1 - core/src/main/scala/kafka/server/BrokerStates.scala | 16 +++++++--------- docs/upgrade.html | 6 ++++++ 3 files changed, 13 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/cf03f349/core/src/main/scala/kafka/controller/KafkaController.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/kafka/controller/KafkaController.scala b/core/src/main/scala/kafka/controller/KafkaController.scala index 1584cc9..8b89c8d 100755 --- a/core/src/main/scala/kafka/controller/KafkaController.scala +++ b/core/src/main/scala/kafka/controller/KafkaController.scala @@ -337,7 +337,6 @@ class KafkaController(val config : KafkaConfig, zkUtils: ZkUtils, val brokerStat // register the partition change listeners for all existing topics on failover controllerContext.allTopics.foreach(topic => partitionStateMachine.registerPartitionChangeListener(topic)) info("Broker %d is ready to serve as the new controller with epoch %d".format(config.brokerId, epoch)) - brokerState.newState(RunningAsController) maybeTriggerPartitionReassignment() maybeTriggerPreferredReplicaElection() /* send partition leadership info to all live brokers */ http://git-wip-us.apache.org/repos/asf/kafka/blob/cf03f349/core/src/main/scala/kafka/server/BrokerStates.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/kafka/server/BrokerStates.scala b/core/src/main/scala/kafka/server/BrokerStates.scala index e6ee77e..2b66beb 100644 --- a/core/src/main/scala/kafka/server/BrokerStates.scala +++ b/core/src/main/scala/kafka/server/BrokerStates.scala @@ -32,14 +32,13 @@ package kafka.server * +-----+-----+ | +----+------------+ * | +>+RecoveringFrom | * v |UncleanShutdown | - * +----------+ +-----+-----+ +-------+---------+ - * |RunningAs | |RunningAs | | - * |Controller+<--->+Broker +<-----------+ - * +----------+ +-----+-----+ - * | | - * | v - * | +-----+------------+ - * |-----> |PendingControlled | + * +-------+-------+ +-------+---------+ + * |RunningAsBroker| | + * +-------+-------+<-----------+ + * | + * v + * +-----+------------+ + * |PendingControlled | * |Shutdown | * +-----+------------+ * | @@ -61,7 +60,6 @@ case object NotRunning extends BrokerStates { val state: Byte = 0 } case object Starting extends BrokerStates { val state: Byte = 1 } case object RecoveringFromUncleanShutdown extends BrokerStates { val state: Byte = 2 } case object RunningAsBroker extends BrokerStates { val state: Byte = 3 } -case object RunningAsController extends BrokerStates { val state: Byte = 4 } case object PendingControlledShutdown extends BrokerStates { val state: Byte = 6 } case object BrokerShuttingDown extends BrokerStates { val state: Byte = 7 } http://git-wip-us.apache.org/repos/asf/kafka/blob/cf03f349/docs/upgrade.html ---------------------------------------------------------------------- diff --git a/docs/upgrade.html b/docs/upgrade.html index a9a1443..9807bcb 100644 --- a/docs/upgrade.html +++ b/docs/upgrade.html @@ -17,6 +17,12 @@ <h3><a id="upgrade" href="#upgrade">1.5 Upgrading From Previous Versions</a></h3> +<h5><a id="upgrade_1010_notable" href="#upgrade_1010_notable">Notable changes in 0.10.1.0</a></h5> + +<ul> + <li> The BrokerState "RunningAsController" (value 4) has been removed. Due to a bug, a broker would only be in this state briefly before transitioning out of it and hence the impact of the removal should be minimal. The recommended way to detect if a given broker is the controller is via the kafka.controller:type=KafkaController,name=ActiveControllerCount metric. </li> +</ul> + <h4><a id="upgrade_10" href="#upgrade_10">Upgrading from 0.8.x or 0.9.x to 0.10.0.0</a></h4> 0.10.0.0 has <a href="#upgrade_10_breaking">potential breaking changes</a> (please review before upgrading) and there may be a <a href="#upgrade_10_performance_impact">performance impact during the upgrade</a>. Because new protocols
