kevinrr888 commented on code in PR #5786:
URL: https://github.com/apache/accumulo/pull/5786#discussion_r2293955212


##########
core/src/main/java/org/apache/accumulo/core/fate/zookeeper/FateLock.java:
##########
@@ -251,7 +261,7 @@ public void removeEntry(FateLockEntry data, long entry) {
   public static SortedSet<NodeName> validateAndWarn(FateLockPath path, 
List<String> children) {
     log.trace("validating and sorting children at path {}", path);
 
-    SortedSet<NodeName> validChildren = new TreeSet<>();
+    SortedSet<NodeName> validChildren = new 
TreeSet<>(Comparator.comparingLong(nn -> nn.sequence));

Review Comment:
   > Adding compareTo method to the class should compare on all fields in the 
class, which adds a lot of complexity to the code that is not needed
   
   Good point. Was worried about possible uses of NameNode in some sorted 
collection, with dev not realizing that they aren't comparable. But my IDE 
warns when you are using a sorted collection with non-comparable elts, and it 
falls more on the dev to understand the class they are working with.
   
   So, I agree and think current impl is good



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