Browse Source

KAFKA-15450 Don't allow ZK migration with JBOD (#14367)

Reviewers: Ron Dagostino <rndgstn@gmail.com>
pull/10062/merge
David Arthur 1 year ago committed by GitHub
parent
commit
50693198e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      core/src/main/scala/kafka/server/KafkaConfig.scala
  2. 12
      core/src/test/scala/unit/kafka/server/KafkaConfigTest.scala

1
core/src/main/scala/kafka/server/KafkaConfig.scala

@ -2373,6 +2373,7 @@ class KafkaConfig private(doLog: Boolean, val props: java.util.Map[_, _], dynami @@ -2373,6 +2373,7 @@ class KafkaConfig private(doLog: Boolean, val props: java.util.Map[_, _], dynami
s"${KafkaConfig.ControllerListenerNamesProp} must not be empty when running in ZooKeeper migration mode: ${controllerListenerNames.asJava}")
require(interBrokerProtocolVersion.isMigrationSupported, s"Cannot enable ZooKeeper migration without setting " +
s"'${KafkaConfig.InterBrokerProtocolVersionProp}' to 3.4 or higher")
require(logDirs.size == 1, "Cannot enable ZooKeeper migration when multiple log directories (aka JBOD) are in use.")
} else {
// controller listener names must be empty when not in KRaft mode
require(controllerListenerNames.isEmpty,

12
core/src/test/scala/unit/kafka/server/KafkaConfigTest.scala

@ -1744,6 +1744,18 @@ class KafkaConfigTest { @@ -1744,6 +1744,18 @@ class KafkaConfigTest {
KafkaConfig.fromProps(props)
}
@Test
def testMigrationCannotBeEnabledWithJBOD(): Unit = {
val props = TestUtils.createBrokerConfig(1, TestUtils.MockZkConnect, port = TestUtils.MockZkPort, logDirCount = 2)
props.setProperty(KafkaConfig.MigrationEnabledProp, "true")
props.setProperty(KafkaConfig.QuorumVotersProp, "3000@localhost:9093")
props.setProperty(KafkaConfig.ControllerListenerNamesProp, "CONTROLLER")
assertEquals(
"requirement failed: Cannot enable ZooKeeper migration when multiple log directories (aka JBOD) are in use.",
assertThrows(classOf[IllegalArgumentException], () => KafkaConfig.fromProps(props)).getMessage)
}
@Test
def testMigrationEnabledKRaftMode(): Unit = {
val props = new Properties()

Loading…
Cancel
Save