[
https://issues.apache.org/jira/browse/KAFKA-21531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lucy Liu updated KAFKA-21531:
-----------------------------
Description:
In ReplicationControlTestContext,
\{{setSessionTimeoutNs(TimeUnit.MILLISECONDS.convert(BROKER_SESSION_TIMEOUT_MS,
TimeUnit.NANOSECONDS))}} converts 1000 _nanoseconds_ to milliseconds, so the
broker session timeout is actually 0 instead
of the intended 1 second.
The existing tests in \{{ReplicationControlManagerTest}} depend on this.
Fixing only the conversion makes 17 of them fail, because \{{fenceBrokers}}
sleeps exactly \{{BROKER_SESSION_TIMEOUT_MS}}, while
\{{BrokerHeartbeatTracker#isExpired}} only treats a session as expired when
\{{nowNs}} is strictly greater than \{{timeNs + sessionTimeoutNs}}.
was:
{{setSessionTimeoutNs(TimeUnit.MILLISECONDS.convert(BROKER_SESSION_TIMEOUT_MS,
TimeUnit.NANOSECONDS))}} converts 1000 _nanoseconds_ to milliseconds, so the
session timeout is actually 0 instead of the intended 1 second. The intended
form would be {{{}TimeUnit.MILLISECONDS.toNanos(BROKER_SESSION_TIMEOUT_MS){}}}.
Fixing only the conversion makes 17 tests in {{ReplicationControlManagerTest}}
fail, because {{fenceBrokers}} sleeps exactly
{{{}BROKER_SESSION_TIMEOUT_MS{}}}, while {{BrokerHeartbeatTracker#isExpired}}
only treats a session as expired when {{timeNs + sessionTimeoutNs < nowNs}}
(strictly greater). So a proper fix also needs the sleep in {{fenceBrokers}}
adjusted.
> setSessionTimeout works incorrectly in ReplicationControlTestContext
> --------------------------------------------------------------------
>
> Key: KAFKA-21531
> URL: https://issues.apache.org/jira/browse/KAFKA-21531
> Project: Kafka
> Issue Type: Test
> Components: controller
> Reporter: Lucy Liu
> Priority: Minor
> Fix For: 4.5.0
>
>
> In ReplicationControlTestContext,
> \{{setSessionTimeoutNs(TimeUnit.MILLISECONDS.convert(BROKER_SESSION_TIMEOUT_MS,
> TimeUnit.NANOSECONDS))}} converts 1000 _nanoseconds_ to milliseconds, so the
> broker session timeout is actually 0 instead
> of the intended 1 second.
> The existing tests in \{{ReplicationControlManagerTest}} depend on this.
> Fixing only the conversion makes 17 of them fail, because \{{fenceBrokers}}
> sleeps exactly \{{BROKER_SESSION_TIMEOUT_MS}}, while
> \{{BrokerHeartbeatTracker#isExpired}} only treats a session as expired when
> \{{nowNs}} is strictly greater than \{{timeNs + sessionTimeoutNs}}.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)