From baa7a3517716d59958bb1db5a961ee3aafb081a4 Mon Sep 17 00:00:00 2001 From: Gwen Shapira Date: Tue, 21 Apr 2015 17:09:37 -0700 Subject: [PATCH] fixed missing configuration and added test --- core/src/main/scala/kafka/server/KafkaServer.scala | 1 + .../unit/kafka/integration/MinIsrConfigTest.scala | 37 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala diff --git a/core/src/main/scala/kafka/server/KafkaServer.scala b/core/src/main/scala/kafka/server/KafkaServer.scala index c63f4ba..bc42f05 100755 --- a/core/src/main/scala/kafka/server/KafkaServer.scala +++ b/core/src/main/scala/kafka/server/KafkaServer.scala @@ -381,6 +381,7 @@ class KafkaServer(val config: KafkaConfig, time: Time = SystemTime) extends Logg fileDeleteDelayMs = config.logDeleteDelayMs, minCleanableRatio = config.logCleanerMinCleanRatio, compact = config.logCleanupPolicy.trim.toLowerCase == "compact", + minInSyncReplicas = config.minInSyncReplicas, compressionType = config.compressionType) val defaultProps = defaultLogConfig.toProps val configs = AdminUtils.fetchAllTopicConfigs(zkClient).mapValues(LogConfig.fromProps(defaultProps, _)) diff --git a/core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala b/core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala new file mode 100644 index 0000000..70a5b3a --- /dev/null +++ b/core/src/test/scala/unit/kafka/integration/MinIsrConfigTest.scala @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package unit.kafka.integration + +import java.util.Properties + +import kafka.integration.KafkaServerTestHarness +import kafka.server.KafkaConfig +import kafka.utils.TestUtils +import org.scalatest.junit.JUnit3Suite + +class MinIsrConfigTest extends JUnit3Suite with KafkaServerTestHarness { + + val overridingProps = new Properties() + overridingProps.put(KafkaConfig.MinInSyncReplicasProp, "5") + def generateConfigs() = TestUtils.createBrokerConfigs(1, zkConnect).map(KafkaConfig.fromProps(_, overridingProps)) + + def testDefaultKafkaConfig() { + assert(servers.head.getLogManager().defaultConfig.minInSyncReplicas == 5) + } + +} -- 2.3.2 (Apple Git-55)