unknowntpo commented on PR #24246:
URL: https://github.com/apache/kafka/pull/24246#issuecomment-6903167432

   > [@chia7712](https://github.com/chia7712) I let Claude scan through 
existing code and noticed an existing issue.
   > 
   > 
`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.
   > 
   > To keep this PR a pure move, I left it as is. Should I open a follow-up 
ticket for it?
   
   About the session timeout: +1 for a follow-up JIRA, since this PR is a pure 
move.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to