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

    https://github.com/apache/cassandra/pull/224#discussion_r188452737
  
    --- Diff: src/java/org/apache/cassandra/service/StorageProxy.java ---
    @@ -1526,38 +1529,37 @@ protected Verb verb()
          * is unclear we want to mix those latencies with read latencies, so 
this
          * may be a bit involved.
          */
    -    private static InetAddressAndPort findSuitableEndpoint(String 
keyspaceName, DecoratedKey key, String localDataCenter, ConsistencyLevel cl) 
throws UnavailableException
    +    private static Replica findSuitableReplica(String keyspaceName, 
DecoratedKey key, String localDataCenter, ConsistencyLevel cl) throws 
UnavailableException
         {
             Keyspace keyspace = Keyspace.open(keyspaceName);
             IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
    -        List<InetAddressAndPort> endpoints = new ArrayList<>();
    -        StorageService.instance.getLiveNaturalEndpoints(keyspace, key, 
endpoints);
    +        ReplicaList replicas = 
StorageService.instance.getLiveNaturalReplicas(keyspace, key);
     
             // CASSANDRA-13043: filter out those endpoints not accepting 
clients yet, maybe because still bootstrapping
    -        endpoints.removeIf(endpoint -> 
!StorageService.instance.isRpcReady(endpoint));
    +        replicas = replicas.filter(replica -> 
StorageService.instance.isRpcReady(replica.getEndpoint()));
    --- End diff --
    
    if isRpcReady were static you could avoid allocating the lambda.


---

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

Reply via email to