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: [email protected]
For additional commands, e-mail: [email protected]