aditya-kumbhar opened a new pull request, #3551:
URL: https://github.com/apache/bookkeeper/pull/3551

   ### Motivation
   
   AuditorReplicasCheckTest has the following tests that are flaky, detected 
using the [NonDex](https://github.com/TestingResearchIllinois/NonDex) tool.
   testReplicasCheckForLedgersFoundHavingLessThanAQReplicasOfAnEntry()
   testReplicasCheckForLedgersFoundHavingLessThanWQReplicasOfAnEntry()
   testReplicasCheckForLedgersFoundHavingNoReplica()
   testReplicasCheckForLedgersWithEmptySegments()
   
   The tests fail due to non-deterministic ordering in the HashMap 
`segmentEnsembles`
   The following check fails in the `newEnsembleEntry()` method since it 
assumes the ordering of `segmentEnsembles` to be deterministic:
   ```
   checkArgument(ensembles.isEmpty() || firstEntry > ensembles.lastKey(),
                         "New entry must have a first entry greater than any 
existing ensemble key");
   ```
   
   Command to reproduce:
   ```
   mvn -pl bookkeeper-server edu.illinois:nondex-maven-plugin:1.1.2:nondex 
-Dtest=org.apache.bookkeeper.replication.AuditorReplicasCheckTest
   ```
   
   ### Changes
   
   Changed the datatype of `segmentEnsembles` from HashMap to 
[LinkedHashMap](https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html)
 as it has a deterministic iteration order, while 
[HashMap](https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html) 
does not guarantee the order of its elements.
   The tests pass with NonDex after making this change.
   


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

Reply via email to