Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/224#discussion_r187434827
  
    --- Diff: src/java/org/apache/cassandra/batchlog/BatchlogManager.java ---
    @@ -490,16 +497,16 @@ private static int gcgs(Collection<Mutation> 
mutations)
             {
                 private final Set<InetAddressAndPort> undelivered = 
Collections.newSetFromMap(new ConcurrentHashMap<>());
     
    -            ReplayWriteResponseHandler(Collection<InetAddressAndPort> 
writeEndpoints, long queryStartNanoTime)
    +            ReplayWriteResponseHandler(Replicas writeReplicas, long 
queryStartNanoTime)
                 {
    -                super(writeEndpoints, 
Collections.<InetAddressAndPort>emptySet(), null, null, null, 
WriteType.UNLOGGED_BATCH, queryStartNanoTime);
    -                undelivered.addAll(writeEndpoints);
    +                super(writeReplicas, ReplicaList.of(), null, null, null, 
WriteType.UNLOGGED_BATCH, queryStartNanoTime);
    +                Iterables.addAll(undelivered, writeReplicas.asEndpoints());
    --- End diff --
    
    This is a case where it seems like we could call a Collections2.transform 
version and not have to create a new list. One thing to keep in mind is that 
Collections2.transform makes contains and remove slow because it's O(n) no 
matter what the underlying collection is.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to