Repository: kafka Updated Branches: refs/heads/trunk f29282092 -> 1a539c74c
MINOR: Improve error message for inconsistent broker ids Provides a more actionable and descriptive error message. Author: Grant Henke <[email protected]> Reviewers: Ashish Singh <[email protected]>, Ewen Cheslack-Postava <[email protected]> Closes #847 from granthenke/broker-id-error Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/1a539c74 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/1a539c74 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/1a539c74 Branch: refs/heads/trunk Commit: 1a539c74c115cbfeaebefee2298e846b4821132c Parents: f292820 Author: Grant Henke <[email protected]> Authored: Fri Feb 5 14:58:45 2016 -0800 Committer: Ewen Cheslack-Postava <[email protected]> Committed: Fri Feb 5 14:58:45 2016 -0800 ---------------------------------------------------------------------- core/src/main/scala/kafka/server/KafkaServer.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/1a539c74/core/src/main/scala/kafka/server/KafkaServer.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/kafka/server/KafkaServer.scala b/core/src/main/scala/kafka/server/KafkaServer.scala index 901ba2e..41719e2 100755 --- a/core/src/main/scala/kafka/server/KafkaServer.scala +++ b/core/src/main/scala/kafka/server/KafkaServer.scala @@ -633,9 +633,14 @@ class KafkaServer(val config: KafkaConfig, time: Time = SystemTime, threadNamePr } if(brokerIdSet.size > 1) - throw new InconsistentBrokerIdException("Failed to match brokerId across logDirs") + throw new InconsistentBrokerIdException( + s"Failed to match broker.id across log.dirs. This could happen if multiple brokers shared a log directory (log.dirs) " + + s"or partial data was manually copied from another broker. Found $brokerIdSet") else if(brokerId >= 0 && brokerIdSet.size == 1 && brokerIdSet.last != brokerId) - throw new InconsistentBrokerIdException("Configured brokerId %s doesn't match stored brokerId %s in meta.properties".format(brokerId, brokerIdSet.last)) + throw new InconsistentBrokerIdException( + s"Configured broker.id $brokerId doesn't match stored broker.id ${brokerIdSet.last} in meta.properties. " + + s"If you moved your data, make sure your configured broker.id matches. " + + s"If you intend to create a new broker, you should remove all data in your data directories (log.dirs).") else if(brokerIdSet.size == 0 && brokerId < 0 && config.brokerIdGenerationEnable) // generate a new brokerId from Zookeeper brokerId = generateBrokerId else if(brokerIdSet.size == 1) // pick broker.id from meta.properties
