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:10 GMT
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: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message