cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aweisberg <...@git.apache.org>
Subject [GitHub] cassandra pull request #224: 14405 replicas
Date Wed, 16 May 2018 17:06:05 GMT
Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/224#discussion_r187439941
  
    --- Diff: src/java/org/apache/cassandra/db/ConsistencyLevel.java ---
    @@ -190,50 +197,50 @@ public int countLocalEndpoints(Iterable<InetAddressAndPort>
liveEndpoints)
              * the blockFor first ones).
              */
             if (isDCLocal)
    -            liveEndpoints.sort(DatabaseDescriptor.getLocalComparator());
    +            liveReplicas.sort(DatabaseDescriptor.getLocalComparator());
     
    -        return liveEndpoints.subList(0, Math.min(liveEndpoints.size(), blockFor(keyspace)));
    +        return liveReplicas.subList(0, Math.min(liveReplicas.size(), blockFor(keyspace)));
         }
     
    -    private List<InetAddressAndPort> filterForEachQuorum(Keyspace keyspace, List<InetAddressAndPort>
liveEndpoints)
    +    private ReplicaList filterForEachQuorum(Keyspace keyspace, ReplicaList liveReplicas)
         {
             NetworkTopologyStrategy strategy = (NetworkTopologyStrategy) keyspace.getReplicationStrategy();
     
    -        Map<String, List<InetAddressAndPort>> dcsEndpoints = new HashMap<>();
    +        Map<String, ReplicaList> dcsReplicas = new HashMap<>();
             for (String dc: strategy.getDatacenters())
    -            dcsEndpoints.put(dc, new ArrayList<>());
    +            dcsReplicas.put(dc, new ReplicaList());
    --- End diff --
    
    Completely overkill and unrelated, but ArrayList will over allocate here if liveReplicas
is < the size of the default allocation of 10


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message