Lucy Liu created KAFKA-21531:
--------------------------------

             Summary: setSessionTimeout works incorrectly in 
ReplicationControlManagerTest
                 Key: KAFKA-21531
                 URL: https://issues.apache.org/jira/browse/KAFKA-21531
             Project: Kafka
          Issue Type: Test
          Components: controller
            Reporter: Lucy Liu
             Fix For: 4.5.0


{{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.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to