[
https://issues.apache.org/jira/browse/KAFKA-7351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16607925#comment-16607925
]
ASF GitHub Bot commented on KAFKA-7351:
---------------------------------------
mutdmour closed pull request #5621: KAFKA-7351 [WIP] return true for non
existant ids in state map
URL: https://github.com/apache/kafka/pull/5621
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
b/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
index 37155ce8ef8..a8f2920c11e 100644
---
a/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
+++
b/clients/src/test/java/org/apache/kafka/clients/ClusterConnectionStatesTest.java
@@ -226,4 +226,11 @@ public void testThrottled() {
assertEquals(connectionStates.connectionDelay(nodeId1,
time.milliseconds()),
connectionStates.pollDelayMs(nodeId1, time.milliseconds()));
}
+
+ @Test
+ public void testIsDisconnectedWithNonExistentIds() {
+ boolean disconnected =
connectionStates.isDisconnected("non_existent_id");
+
+ assertTrue(disconnected);
+ }
}
----------------------------------------------------------------
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)