Nemesis123925 opened a new pull request, #12029:
URL: https://github.com/apache/pinot/pull/12029

   ## Setup:
   Java version: openjdk 11.0.20.1
   Maven version: Apache Maven 3.8.1
   
   ## Fixed Test:
   
`org.apache.pinot.core.transport.server.routing.stats.ServerRoutingStatsManagerTest.testQuerySubmitAndCompletionStats`
   
   ## Test Failure:
   The test's `List<Pair<String, Integer>>` generated by 
`fetchNumInFlightRequestsForAllServers()`, `fetchEMALatencyForAllServers()`, 
and `fetchHybridScoreForAllServers()` shows non-determinism with the order of 
`Pair<String, Integer>` when applying the `NonDex` tool. Although the content 
of the Assertion is all correct, the assertion could assert on wrong index in 
the `List` due to the non-determinism in the `List`. One example could be the 
`List` contatins `{Pair("server1", 1), Pair("server2", 2)}`, but the assertion 
assert that the `List` is `{Pair("server2", 2), Pair("server1", 1)}`.
   
   ## Root Cause:
   The root cause is in the `ConcurrentHashMap` used by 
[`ServerRoutingStatsManager.java`'s 
`_serverQueryStatsMap`](https://github.com/apache/pinot/blob/7217bb9d16b60074c1e9a9df72984556a7c8dbd5/pinot-core/src/main/java/org/apache/pinot/core/transport/server/routing/stats/ServerRoutingStatsManager.java#L50),
 which got iterated to create the `List` using the `entrySet()` function in 
[`fetchNumInFlightRequestsForAllServers`](https://github.com/apache/pinot/blob/7217bb9d16b60074c1e9a9df72984556a7c8dbd5/pinot-core/src/main/java/org/apache/pinot/core/transport/server/routing/stats/ServerRoutingStatsManager.java#L248),
 
[`fetchEMALatencyForAllServers`](https://github.com/apache/pinot/blob/7217bb9d16b60074c1e9a9df72984556a7c8dbd5/pinot-core/src/main/java/org/apache/pinot/core/transport/server/routing/stats/ServerRoutingStatsManager.java#L293),
 and 
[`fetchHybridScoreForAllServers`](https://github.com/apache/pinot/blob/7217bb9d16b60074c1e9a9df72984556a7c8dbd5/pinot-core/src/main/java/org/apache
 
/pinot/core/transport/server/routing/stats/ServerRoutingStatsManager.java#L339).
 The `List<Pair<String, Interger>>` created is directly returned to the 
`testQuerySubmitAndCompletionStats`, which cause the order's non-determinism in 
the `List`.
   
   ## Fix:
   Since the specific part suffering from the non-determinism here only have 
two elements in the `List`, the fix here is to first found the element's index 
(`0` or `1`) before asserting them. This eleminates the non-determinism here 
without modifing the source code in `main` folder.


-- 
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]

Reply via email to