ravikalla opened a new pull request, #20213: URL: https://github.com/apache/kafka/pull/20213
## Summary Fixes the leastLoadedNode() function to prevent selecting nodes in poor connection states during consumer startup, addressing potential connection failures. ## Changes - Improves node selection logic to prioritize connection states more effectively - Ensures only the first connecting node is selected to avoid unnecessary connections - Adds test cases for various node state scenarios ## Test plan - [x] Added comprehensive unit tests for the fix - [x] All existing NetworkClient tests pass (39/39) - [x] No performance degradation - maintains O(n) complexity - [x] Code passes checkstyle validation Resolves the issue where faulty nodes could be chosen during consumer thread startup, improving client startup reliability. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org