You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/05/29 23:55:00 UTC

[jira] [Commented] (KAFKA-5664) Disable auto offset commit in ConsoleConsumer if no group is provided

    [ https://issues.apache.org/jira/browse/KAFKA-5664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16494502#comment-16494502 ] 

ASF GitHub Bot commented on KAFKA-5664:
---------------------------------------

vahidhashemian closed pull request #3593: KAFKA-5664: Disable auto offset commit in ConsoleConsumer if no group is provided
URL: https://github.com/apache/kafka/pull/3593
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
index fd76387db85..9085a08ea29 100755
--- a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
+++ b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
@@ -405,6 +405,10 @@ object ConsoleConsumer extends Logging {
     //Provide the consumer with a randomly assigned group id
     if (!consumerProps.containsKey(ConsumerConfig.GROUP_ID_CONFIG)) {
       consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, s"console-consumer-${new Random().nextInt(100000)}")
+      // By default, avoid polluting the coordinator cache since the auto-generated group
+      // and its offsets won't likely be used again
+      if (!consumerProps.containsKey(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG))
+        consumerProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false")
       groupIdPassed = false
     }
 
diff --git a/docs/upgrade.html b/docs/upgrade.html
index bb3274a84ee..3e90a6a5f37 100644
--- a/docs/upgrade.html
+++ b/docs/upgrade.html
@@ -58,6 +58,8 @@ <h5><a id="upgrade_100_notable" href="#upgrade_100_notable">Notable changes in 1
         whether there is offline log directory. </li>
     <li>Added KafkaStorageException which is a retriable exception. KafkaStorageException will be converted to NotLeaderForPartitionException in the response
         if the version of client's FetchRequest or ProducerRequest does not support KafkaStorageException. </li>
+    <li>The default for console consumer's <code>enable.auto.commit</code> property when no <code>group.id</code> is provided is now set to <code>false</code>.
+        This is to avoid polluting the consumer coordinator cache as the auto-generated group is not likely to be used by other consumers.
 </ul>
 
 <h5><a id="upgrade_100_new_protocols" href="#upgrade_100_new_protocols">New Protocol Versions</a></h5>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Disable auto offset commit in ConsoleConsumer if no group is provided
> ---------------------------------------------------------------------
>
>                 Key: KAFKA-5664
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5664
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Jason Gustafson
>            Assignee: Vahid Hashemian
>            Priority: Major
>
> In ConsoleCosnumer, if no group is provided, we generate a random groupId:
> {code}
> consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, s"console-consumer-${new Random().nextInt(100000)}")
> {code}
> In this case, since the group is not likely to be used again, we should disable automatic offset commits. This avoids polluting the coordinator cache with offsets that will never be used.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)