Interface ReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E>>
-
- All Known Implementing Classes:
AbstractReadRepair
,BlockingReadRepair
,NoopReadRepair
,ReadOnlyReadRepair
public interface ReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E>>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ReadRepair.Factory
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description void
awaitReads()
Block on the reads (or timeout) sent out instartRepair(org.apache.cassandra.service.reads.DigestResolver<E, P>, java.util.function.Consumer<org.apache.cassandra.db.partitions.PartitionIterator>)
void
awaitWrites()
Block on any mutations (or timeout) we sent out to repair replicas inrepairPartition(org.apache.cassandra.db.DecoratedKey, java.util.Map<org.apache.cassandra.locator.Replica, org.apache.cassandra.db.Mutation>, org.apache.cassandra.locator.ReplicaPlan.ForTokenWrite)
static <E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E>>
ReadRepair<E,P>create(ReadCommand command, ReplicaPlan.Shared<E,P> replicaPlan, long queryStartNanoTime)
UnfilteredPartitionIterators.MergeListener
getMergeListener(P replicaPlan)
Used by DataResolver to generate corrections as the partition iterator is consumedvoid
maybeSendAdditionalReads()
if it looks like we might not receive data requests from everyone in time, send additional requests to additional replicas not contacted in the initial full data read.void
maybeSendAdditionalWrites()
If it looks like we might not receive acks for all the repair mutations we sent out, combine all the unacked mutations and send them to the minority of nodes not involved in the read repair data read / write cycle.void
repairPartition(DecoratedKey partitionKey, java.util.Map<Replica,Mutation> mutations, ReplicaPlan.ForTokenWrite writePlan)
Repairs a partition _after_ receiving data responses.void
startRepair(DigestResolver<E,P> digestResolver, java.util.function.Consumer<PartitionIterator> resultConsumer)
Called when the digests from the initial read don't match.
-
-
-
Method Detail
-
create
static <E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E>> ReadRepair<E,P> create(ReadCommand command, ReplicaPlan.Shared<E,P> replicaPlan, long queryStartNanoTime)
-
getMergeListener
UnfilteredPartitionIterators.MergeListener getMergeListener(P replicaPlan)
Used by DataResolver to generate corrections as the partition iterator is consumed
-
startRepair
void startRepair(DigestResolver<E,P> digestResolver, java.util.function.Consumer<PartitionIterator> resultConsumer)
Called when the digests from the initial read don't match. Reads may block on the repair started by this method.- Parameters:
digestResolver
- supplied so we can get the original data responseresultConsumer
- hook for the repair to set it's result on completion
-
awaitReads
void awaitReads() throws ReadTimeoutException
Block on the reads (or timeout) sent out instartRepair(org.apache.cassandra.service.reads.DigestResolver<E, P>, java.util.function.Consumer<org.apache.cassandra.db.partitions.PartitionIterator>)
- Throws:
ReadTimeoutException
-
maybeSendAdditionalReads
void maybeSendAdditionalReads()
if it looks like we might not receive data requests from everyone in time, send additional requests to additional replicas not contacted in the initial full data read. If the collection of nodes that end up responding in time end up agreeing on the data, and we don't consider the response from the disagreeing replica that triggered the read repair, that's ok, since the disagreeing data would not have been successfully written and won't be included in the response the the client, preserving the expectation of monotonic quorum reads
-
maybeSendAdditionalWrites
void maybeSendAdditionalWrites()
If it looks like we might not receive acks for all the repair mutations we sent out, combine all the unacked mutations and send them to the minority of nodes not involved in the read repair data read / write cycle. We will accept acks from them in lieu of acks from the initial mutations sent out, so long as we receive the same number of acks as repair mutations transmitted. This prevents misbehaving nodes from killing a quorum read, while continuing to guarantee monotonic quorum reads
-
awaitWrites
void awaitWrites()
Block on any mutations (or timeout) we sent out to repair replicas inrepairPartition(org.apache.cassandra.db.DecoratedKey, java.util.Map<org.apache.cassandra.locator.Replica, org.apache.cassandra.db.Mutation>, org.apache.cassandra.locator.ReplicaPlan.ForTokenWrite)
-
repairPartition
void repairPartition(DecoratedKey partitionKey, java.util.Map<Replica,Mutation> mutations, ReplicaPlan.ForTokenWrite writePlan)
Repairs a partition _after_ receiving data responses. This method receives replica list, since we will block repair only on the replicas that have responded.
-
-