dlmarion commented on issue #5496:
URL: https://github.com/apache/accumulo/issues/5496#issuecomment-2824239934

   @keith-turner  - I'm building this fix if you want to test this. The 
existing code is creating a new array list, copying in the existing mutations, 
adding the new mutations, then putting the array list back into the map. I 
think we can just get a reference to the list in the map and add the mutations 
directly by reference.
   
   ```
   diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
   index 442b2f85f9..f0653b6d3f 100644
   --- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
   +++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
   @@ -274,12 +274,7 @@ public class LogSorter {
          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);
        }
   
   ```
   


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