Class NoopReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
- java.lang.Object
-
- org.apache.cassandra.service.reads.repair.NoopReadRepair<E,P>
-
- All Implemented Interfaces:
ReadRepair<E,P>
public class NoopReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>> extends java.lang.Object implements ReadRepair<E,P>
Bypasses the read repair path for short read protection and testing
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.service.reads.repair.ReadRepair
ReadRepair.Factory
-
-
Field Summary
Fields Modifier and Type Field Description static NoopReadRepair
instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
awaitReads()
Block on the reads (or timeout) sent out inReadRepair.startRepair(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 inReadRepair.repairPartition(org.apache.cassandra.db.DecoratedKey, java.util.Map<org.apache.cassandra.locator.Replica, org.apache.cassandra.db.Mutation>, org.apache.cassandra.locator.ReplicaPlan.ForWrite)
UnfilteredPartitionIterators.MergeListener
getMergeListener(P replicas)
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.ForWrite 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.
-
-
-
Field Detail
-
instance
public static final NoopReadRepair instance
-
-
Method Detail
-
getMergeListener
public UnfilteredPartitionIterators.MergeListener getMergeListener(P replicas)
Description copied from interface:ReadRepair
Used by DataResolver to generate corrections as the partition iterator is consumed- Specified by:
getMergeListener
in interfaceReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
-
startRepair
public void startRepair(DigestResolver<E,P> digestResolver, java.util.function.Consumer<PartitionIterator> resultConsumer)
Description copied from interface:ReadRepair
Called when the digests from the initial read don't match. Reads may block on the repair started by this method.- Specified by:
startRepair
in interfaceReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
- Parameters:
digestResolver
- supplied so we can get the original data responseresultConsumer
- hook for the repair to set it's result on completion
-
awaitReads
public void awaitReads() throws ReadTimeoutException
Description copied from interface:ReadRepair
Block on the reads (or timeout) sent out inReadRepair.startRepair(org.apache.cassandra.service.reads.DigestResolver<E, P>, java.util.function.Consumer<org.apache.cassandra.db.partitions.PartitionIterator>)
- Specified by:
awaitReads
in interfaceReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
- Throws:
ReadTimeoutException
-
maybeSendAdditionalReads
public void maybeSendAdditionalReads()
Description copied from interface:ReadRepair
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- Specified by:
maybeSendAdditionalReads
in interfaceReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
-
maybeSendAdditionalWrites
public void maybeSendAdditionalWrites()
Description copied from interface:ReadRepair
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- Specified by:
maybeSendAdditionalWrites
in interfaceReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
-
awaitWrites
public void awaitWrites()
Description copied from interface:ReadRepair
Block on any mutations (or timeout) we sent out to repair replicas inReadRepair.repairPartition(org.apache.cassandra.db.DecoratedKey, java.util.Map<org.apache.cassandra.locator.Replica, org.apache.cassandra.db.Mutation>, org.apache.cassandra.locator.ReplicaPlan.ForWrite)
- Specified by:
awaitWrites
in interfaceReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
-
repairPartition
public void repairPartition(DecoratedKey partitionKey, java.util.Map<Replica,Mutation> mutations, ReplicaPlan.ForWrite writePlan)
Description copied from interface:ReadRepair
Repairs a partition _after_ receiving data responses. This method receives replica list, since we will block repair only on the replicas that have responded.- Specified by:
repairPartition
in interfaceReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E,P>>
-
-