dlmarion commented on code in PR #5497:
URL: https://github.com/apache/accumulo/pull/5497#discussion_r2056283198


##########
server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java:
##########
@@ -274,12 +274,7 @@ void writeBuffer(String destPath, 
List<Pair<LogFileKey,LogFileValue>> buffer, in
       var logFileKey = pair.getFirst();
       var logFileValue = pair.getSecond();
       Key k = logFileKey.toKey();
-      var list = keyListMap.putIfAbsent(k, logFileValue.mutations);
-      if (list != null) {
-        var muts = new ArrayList<>(list);
-        muts.addAll(logFileValue.mutations);
-        keyListMap.put(logFileKey.toKey(), muts);
-      }
+      keyListMap.computeIfAbsent(k, (key) -> new 
ArrayList<>()).addAll(logFileValue.mutations);

Review Comment:
   Good point about not copying in the first case. The code was optimal when 
the key was only seen once.



-- 
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: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to