Class AbstractReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E>>
- java.lang.Object
-
- org.apache.cassandra.service.reads.repair.AbstractReadRepair<E,P>
-
- All Implemented Interfaces:
ReadRepair<E,P>
- Direct Known Subclasses:
BlockingReadRepair
,ReadOnlyReadRepair
public abstract class AbstractReadRepair<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E>> extends java.lang.Object implements ReadRepair<E,P>
-
-
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 protected ColumnFamilyStore
cfs
protected ReadCommand
command
protected long
queryStartNanoTime
protected ReplicaPlan.Shared<E,P>
replicaPlan
-
Constructor Summary
Constructors Constructor Description AbstractReadRepair(ReadCommand command, ReplicaPlan.Shared<E,P> replicaPlan, long queryStartNanoTime)
-
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
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.protected P
replicaPlan()
void
startRepair(DigestResolver<E,P> digestResolver, java.util.function.Consumer<PartitionIterator> resultConsumer)
Called when the digests from the initial read don't match.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.service.reads.repair.ReadRepair
awaitWrites, getMergeListener, maybeSendAdditionalWrites, repairPartition
-
-
-
-
Field Detail
-
command
protected final ReadCommand command
-
queryStartNanoTime
protected final long queryStartNanoTime
-
replicaPlan
protected final ReplicaPlan.Shared<E extends Endpoints<E>,P extends ReplicaPlan.ForRead<E>> replicaPlan
-
cfs
protected final ColumnFamilyStore cfs
-
-
Constructor Detail
-
AbstractReadRepair
public AbstractReadRepair(ReadCommand command, ReplicaPlan.Shared<E,P> replicaPlan, long queryStartNanoTime)
-
-
Method Detail
-
replicaPlan
protected P replicaPlan()
-
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>>
- 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>>
- 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>>
-
-