[ 
https://issues.apache.org/jira/browse/KAFKA-7351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16607338#comment-16607338
 ] 

ASF GitHub Bot commented on KAFKA-7351:
---------------------------------------

mutdmour opened a new pull request #5621: KAFKA-7351 return true for non 
existant ids in state map
URL: https://github.com/apache/kafka/pull/5621
 
 
   Description
   Handle case when id of node does not exist in ClusterConnectionStates
   
   Testing
   Added unit test for specific case.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Wrong logic in method ClusterConnectionStates.isDisconnected
> ------------------------------------------------------------
>
>                 Key: KAFKA-7351
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7351
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 2.0.0
>            Reporter: Boris Zhguchev
>            Priority: Minor
>
> I think the method 
> org.apache.kafka.clients.ClusterConnectionStates.isDisconnected
> has wrong logic in proccesing wrong ids.
> {code:java}
> @Before
> public void setup() {
>     this.connectionStates = new ClusterConnectionStates(10_000, 60_000);
> }
> @Test
> public void testIsDisconnected(){
>     boolean connected = connectionStates.isConnected("fake_node");
>     boolean disconnected = connectionStates.isDisconnected("fake_node");
>     assertFalse(connected); // false
>     assertFalse(disconnected); // false
> }
> {code}
> It can be related with that that code block:
> {code:java}
> public boolean isDisconnected(String id) {
>   NodeConnectionState state = nodeState.get(id);
> // may be better is state == null ? true : state.isDisconnected()
>   return state != null && state.state.isDisconnected(); 
> }
> {code}
> [link|https://github.com/apache/kafka/blob/19b8ac55c389e4b2022476431a28c8431caed52a/clients/src/main/java/org/apache/kafka/clients/ClusterConnectionStates.java#L252]
>  to github



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to