yifan-c commented on code in PR #17:
URL:
https://github.com/apache/cassandra-analytics/pull/17#discussion_r1370984138
##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/token/ConsistencyLevel.java:
##########
@@ -82,19 +119,25 @@ public boolean checkConsistency(Collection<? extends
CassandraInstance> failedIn
},
QUORUM
{
+ // Keyspaces exist with RF 1 or 2
@Override
public boolean isLocal()
{
return false;
}
@Override
- public boolean checkConsistency(Collection<? extends
CassandraInstance> failedInsts,
- ReplicationFactor
replicationFactor,
- String localDC)
+ public boolean checkConsistency(final CassandraRing ring,
+ final TokenRangeMapping<? extends
CassandraInstance> tokenRangeMapping,
+ final Collection<? extends
CassandraInstance> failedInsts,
+ final String localDC)
{
- int rf = replicationFactor.getTotalReplicationFactor();
- return failedInsts.size() <= (rf - (rf / 2 + 1));
+ Set<String> replacingInstances =
tokenRangeMapping.getReplacementInstances();
+ Set<String> failedInstanceIPs =
failedInsts.stream().map(CassandraInstance::getIpAddress).collect(Collectors.toSet());
+ final long writeReplicaCount =
maybeUpdateWriteReplicasForReplacements(tokenRangeMapping.getWriteReplicas(),
+
replacingInstances,
+
failedInstanceIPs);
Review Comment:
Similar to the API change comment. It is not the consistency level variants'
responsibility to calculate the effective write replica set.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]