You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by rs...@apache.org on 2017/06/13 14:58:47 UTC

kafka git commit: MINOR: Generate deprecated warning for static default quota config

Repository: kafka
Updated Branches:
  refs/heads/trunk aaca1b478 -> 136b03868


MINOR: Generate deprecated warning for static default quota config

The default client-id bandwidth quota config properties have been marked deprecated in the doc, but a warning may be useful before the property is removed in a future release.

Author: Rajini Sivaram <ra...@googlemail.com>

Reviewers: Ismael Juma <is...@juma.me.uk>

Closes #3315 from rajinisivaram/MINOR-deprecate-staticquota


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

Branch: refs/heads/trunk
Commit: 136b03868a3156b1566f109eb47b3832b02c14f7
Parents: aaca1b4
Author: Rajini Sivaram <ra...@googlemail.com>
Authored: Tue Jun 13 15:58:22 2017 +0100
Committer: Rajini Sivaram <ra...@googlemail.com>
Committed: Tue Jun 13 15:58:22 2017 +0100

----------------------------------------------------------------------
 core/src/main/scala/kafka/server/QuotaFactory.scala | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/136b0386/core/src/main/scala/kafka/server/QuotaFactory.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/server/QuotaFactory.scala b/core/src/main/scala/kafka/server/QuotaFactory.scala
index dee39a3..b70f2e5 100644
--- a/core/src/main/scala/kafka/server/QuotaFactory.scala
+++ b/core/src/main/scala/kafka/server/QuotaFactory.scala
@@ -17,6 +17,7 @@
 package kafka.server
 
 import kafka.server.QuotaType._
+import kafka.utils.Logging
 import org.apache.kafka.common.TopicPartition
 import org.apache.kafka.common.metrics.Metrics
 import org.apache.kafka.common.utils.Time
@@ -30,7 +31,7 @@ object QuotaType  {
 }
 sealed trait QuotaType
 
-object QuotaFactory {
+object QuotaFactory extends Logging {
 
   object UnboundedQuota extends ReplicaQuota {
     override def isThrottled(topicPartition: TopicPartition): Boolean = false
@@ -55,19 +56,25 @@ object QuotaFactory {
     )
   }
 
-  def clientProduceConfig(cfg: KafkaConfig): ClientQuotaManagerConfig =
+  def clientProduceConfig(cfg: KafkaConfig): ClientQuotaManagerConfig = {
+    if (cfg.producerQuotaBytesPerSecondDefault != Long.MaxValue)
+      warn(s"${KafkaConfig.ProducerQuotaBytesPerSecondDefaultProp} has been deprecated in 0.11.0.0 and will be removed in a future release. Use dynamic quota defaults instead.")
     ClientQuotaManagerConfig(
       quotaBytesPerSecondDefault = cfg.producerQuotaBytesPerSecondDefault,
       numQuotaSamples = cfg.numQuotaSamples,
       quotaWindowSizeSeconds = cfg.quotaWindowSizeSeconds
     )
+  }
 
-  def clientFetchConfig(cfg: KafkaConfig): ClientQuotaManagerConfig =
+  def clientFetchConfig(cfg: KafkaConfig): ClientQuotaManagerConfig = {
+    if (cfg.consumerQuotaBytesPerSecondDefault != Long.MaxValue)
+      warn(s"${KafkaConfig.ConsumerQuotaBytesPerSecondDefaultProp} has been deprecated in 0.11.0.0 and will be removed in a future release. Use dynamic quota defaults instead.")
     ClientQuotaManagerConfig(
       quotaBytesPerSecondDefault = cfg.consumerQuotaBytesPerSecondDefault,
       numQuotaSamples = cfg.numQuotaSamples,
       quotaWindowSizeSeconds = cfg.quotaWindowSizeSeconds
     )
+  }
 
   def clientRequestConfig(cfg: KafkaConfig): ClientQuotaManagerConfig = {
     ClientQuotaManagerConfig(