You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/09/20 16:29:29 UTC

[GitHub] [kafka] jolshan commented on a diff in pull request #12643: KAFKA-14097: make producer ID expiration a dynamic config

jolshan commented on code in PR #12643:
URL: https://github.com/apache/kafka/pull/12643#discussion_r975585267


##########
core/src/main/scala/kafka/log/ProducerStateManager.scala:
##########
@@ -939,3 +940,24 @@ object SnapshotFile {
     SnapshotFile(file, offset)
   }
 }
+
+class ProducerStateManagerConfig(@volatile var producerIdExpirationMs: Int) extends Logging with BrokerReconfigurable {
+
+  override def reconfigurableConfigs: Set[String] = Set(KafkaConfig.ProducerIdExpirationMsProp)
+
+  override def reconfigure(oldConfig: KafkaConfig, newConfig: KafkaConfig): Unit = {
+    if (producerIdExpirationMs != newConfig.producerIdExpirationMs) {
+      info(s"Reconfigure ${KafkaConfig.ProducerIdExpirationMsProp} from $producerIdExpirationMs to ${newConfig.producerIdExpirationMs}")
+      producerIdExpirationMs = newConfig.producerIdExpirationMs
+    }
+  }
+
+  override def validateReconfiguration(newConfig: KafkaConfig): Unit = {
+    if (newConfig.producerIdExpirationMs < 0)
+      throw new ConfigException(s"${KafkaConfig.ProducerIdExpirationMsProp} cannot be less than 0, current value is $producerIdExpirationMs")
+  }
+}
+
+object ProducerStateManagerConfig {
+  val ReconfigurableConfigs = Set(KafkaConfig.ProducerIdExpirationMsProp)

Review Comment:
   This is required to override the class.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org