yashdeep97 commented on code in PR #15418:
URL: https://github.com/apache/druid/pull/15418#discussion_r1428978984
##########
services/src/test/java/org/apache/druid/server/router/TieredBrokerHostSelectorTest.java:
##########
@@ -367,18 +368,18 @@ public void testGetAllBrokers()
{
Assert.assertEquals(
ImmutableMap.of(
- "mediumBroker", ImmutableList.of(),
- "coldBroker", ImmutableList.of("coldHost1:8080", "coldHost2:8080"),
- "hotBroker", ImmutableList.of("hotHost:8080")
+ "mediumBroker", ImmutableSet.of(),
Review Comment:
So, it used `servers` which is a `ConcurrentHashMap` to create the list of
Hostnames.(https://github.com/apache/druid/blob/e373f6269251655f5be93ce895aee8dee8cc67dd/services/src/main/java/org/apache/druid/server/router/TieredBrokerHostSelector.java#L63)
And ConcurrentHashMap does not preserve the the ordering of the keys, which
can result in the order of servers being different that what is expected in the
Assert.
For example: we might get ImmutableList.of("coldHost2:8080",
"coldHost1:8080") instead of ImmutableList.of("coldHost1:8080",
"coldHost2:8080") which will result in the test failing.
Thus, the code incorrectly assumes deterministic ordering of the keys in
ConcurrentHashMap.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]