You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2022/12/28 18:34:16 UTC

[kafka] branch trunk updated: MINOR: Use `LogConfig.validate` instead of `validateValues` in `KafkaMetadataLog` (#13051)

This is an automated email from the ASF dual-hosted git repository.

ijuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new da56c1cf299 MINOR: Use `LogConfig.validate` instead of `validateValues` in `KafkaMetadataLog` (#13051)
da56c1cf299 is described below

commit da56c1cf2992a868be02b94120ce22a3978aecd0
Author: Ismael Juma <is...@juma.me.uk>
AuthorDate: Wed Dec 28 10:34:08 2022 -0800

    MINOR: Use `LogConfig.validate` instead of `validateValues` in `KafkaMetadataLog` (#13051)
    
    `LogConfig.validateValues` may fail or incorrectly succeed if the properties don't include defaults.
    
    During the conversion of `LogConfig` to Java (#13049), it became clear that the `asInstanceOf[Long]`
    calls in `LogConfig.validateValues` were converting `null` to `0` when this method was invoked
    from `KafkaMetadataLog`. This means that it would be possible for it to validate successfully
    in cases where it should not.
    
    Reviewers: José Armando García Sancio <js...@apache.org>
---
 core/src/main/scala/kafka/raft/KafkaMetadataLog.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/src/main/scala/kafka/raft/KafkaMetadataLog.scala b/core/src/main/scala/kafka/raft/KafkaMetadataLog.scala
index a892d9c235b..28953ab1846 100644
--- a/core/src/main/scala/kafka/raft/KafkaMetadataLog.scala
+++ b/core/src/main/scala/kafka/raft/KafkaMetadataLog.scala
@@ -565,7 +565,7 @@ object KafkaMetadataLog extends Logging {
     // Disable time and byte retention when deleting segments
     props.setProperty(LogConfig.RetentionMsProp, "-1")
     props.setProperty(LogConfig.RetentionBytesProp, "-1")
-    LogConfig.validateValues(props)
+    LogConfig.validate(props)
     val defaultLogConfig = LogConfig(props)
 
     if (config.logSegmentBytes < config.logSegmentMinBytes) {