From c8570fe2e8ef5da8065f0e6129ba19808991c63f Mon Sep 17 00:00:00 2001 From: ppatierno Date: Mon, 12 Jun 2017 11:04:16 +0200 Subject: [PATCH 1/2] Avoiding attempt to connect to Zookeeper on closing consumer for deleting random group.id with the new one --- core/src/main/scala/kafka/tools/ConsoleConsumer.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala index 335c724ee5c2b..9e338f7e22c13 100755 --- a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala +++ b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala @@ -82,7 +82,8 @@ object ConsoleConsumer extends Logging { reportRecordCount() // if we generated a random group id (as none specified explicitly) then avoid polluting zookeeper with persistent group data, this is a hack - if (!conf.groupIdPassed) + // NOTE : this is true only for the Old consumer, because the New one doesn't create an entry to "/consumers" + if (conf.useOldConsumer && !conf.groupIdPassed) ZkUtils.maybeDeletePath(conf.options.valueOf(conf.zkConnectOpt), "/consumers/" + conf.consumerProps.get("group.id")) shutdownLatch.countDown() From a81c34b763c6ef428332ed5435cd774df1bb56ed Mon Sep 17 00:00:00 2001 From: Paolo Patierno Date: Fri, 17 Nov 2017 09:58:30 +0100 Subject: [PATCH 2/2] Removed additional comment --- core/src/main/scala/kafka/tools/ConsoleConsumer.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala index 9e338f7e22c13..a99ad15cace1c 100755 --- a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala +++ b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala @@ -82,7 +82,6 @@ object ConsoleConsumer extends Logging { reportRecordCount() // if we generated a random group id (as none specified explicitly) then avoid polluting zookeeper with persistent group data, this is a hack - // NOTE : this is true only for the Old consumer, because the New one doesn't create an entry to "/consumers" if (conf.useOldConsumer && !conf.groupIdPassed) ZkUtils.maybeDeletePath(conf.options.valueOf(conf.zkConnectOpt), "/consumers/" + conf.consumerProps.get("group.id"))