You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KAFKA-19432 Add an ERROR log message if broker.heartbeat.interval.ms is too large (apache#20046)
* Log error message if `broker.heartbeat.interval.ms * 2` is large than
`broker.session.timeout.ms`.
* Add test case
`testLogBrokerHeartbeatIntervalMsShouldBeLowerThanHalfOfBrokerSessionTimeoutMs`.
Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
Copy file name to clipboardExpand all lines: core/src/main/scala/kafka/server/KafkaConfig.scala
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -513,6 +513,13 @@ class KafkaConfig private(doLog: Boolean, val props: util.Map[_, _])
513
513
require(replicaFetchWaitMaxMs <= replicaLagTimeMaxMs, "replica.fetch.wait.max.ms should always be less than or equal to replica.lag.time.max.ms"+
514
514
" to prevent frequent changes in ISR")
515
515
516
+
if (brokerHeartbeatIntervalMs *2> brokerSessionTimeoutMs) {
517
+
error(s"${KRaftConfigs.BROKER_HEARTBEAT_INTERVAL_MS_CONFIG} ($brokerHeartbeatIntervalMs ms) must be less than or equal to half of the ${KRaftConfigs.BROKER_SESSION_TIMEOUT_MS_CONFIG} ($brokerSessionTimeoutMs ms). "+
518
+
s"The ${KRaftConfigs.BROKER_SESSION_TIMEOUT_MS_CONFIG} is configured on controller. The ${KRaftConfigs.BROKER_HEARTBEAT_INTERVAL_MS_CONFIG} is configured on broker. "+
519
+
s"If a broker doesn't send heartbeat request within ${KRaftConfigs.BROKER_SESSION_TIMEOUT_MS_CONFIG}, it loses broker lease. "+
520
+
s"Please increase ${KRaftConfigs.BROKER_SESSION_TIMEOUT_MS_CONFIG} or decrease ${KRaftConfigs.BROKER_HEARTBEAT_INTERVAL_MS_CONFIG}.")
assertEquals("requirement failed: controller.listener.names must contain at least one value appearing in the 'listeners' configuration when running the KRaft controller role", message)
assertTrue(appender.getMessages.contains("broker.heartbeat.interval.ms (4500 ms) must be less than or equal to half of the broker.session.timeout.ms (8999 ms). "+
1915
+
"The broker.session.timeout.ms is configured on controller. The broker.heartbeat.interval.ms is configured on broker. "+
1916
+
"If a broker doesn't send heartbeat request within broker.session.timeout.ms, it loses broker lease. "+
1917
+
"Please increase broker.session.timeout.ms or decrease broker.heartbeat.interval.ms."))
0 commit comments