Skip to content

Commit

Permalink
filter out dead replicas for counter writes
Browse files Browse the repository at this point in the history
Patch by brandonwilliams; reviewed by adelapena for CASSANDRA-17411
  • Loading branch information
driftx committed Jun 16, 2022
1 parent c3998ef commit 51ce718
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
@@ -1,4 +1,5 @@
4.0.5
* Fix counter write timeouts at ONE (CASSANDRA-17411)
* Fix NPE in getLocalPrimaryRangeForEndpoint (CASSANDRA-17680)
* Remove SSL storage port from sstableloader (CASSANDRA-17602)
* Allow Java 11 to satisfy RPM/Debian packaging (CASSANDRA-17669)
Expand Down
4 changes: 4 additions & 0 deletions src/java/org/apache/cassandra/service/StorageProxy.java
Expand Up @@ -87,6 +87,7 @@
import org.apache.cassandra.exceptions.UnavailableException;
import org.apache.cassandra.exceptions.WriteFailureException;
import org.apache.cassandra.exceptions.WriteTimeoutException;
import org.apache.cassandra.gms.FailureDetector;
import org.apache.cassandra.gms.Gossiper;
import org.apache.cassandra.hints.Hint;
import org.apache.cassandra.hints.HintsService;
Expand Down Expand Up @@ -1615,6 +1616,9 @@ private static Replica findSuitableReplica(String keyspaceName, DecoratedKey key
// CASSANDRA-13043: filter out those endpoints not accepting clients yet, maybe because still bootstrapping
replicas = replicas.filter(replica -> StorageService.instance.isRpcReady(replica.endpoint()));

// CASSANDRA-17411: filter out endpoints that are not alive
replicas = replicas.filter(replica -> FailureDetector.instance.isAlive(replica.endpoint()));

// TODO have a way to compute the consistency level
if (replicas.isEmpty())
throw UnavailableException.create(cl, cl.blockFor(replicationStrategy), 0);
Expand Down

0 comments on commit 51ce718

Please sign in to comment.