Class AbstractReadExecutor
- java.lang.Object
-
- org.apache.cassandra.service.reads.AbstractReadExecutor
-
- Direct Known Subclasses:
AbstractReadExecutor.NeverSpeculatingReadExecutor
public abstract class AbstractReadExecutor extends java.lang.Object
Sends a read request to the replicas needed to satisfy a given ConsistencyLevel. Optionally, may perform additional requests to provide redundancy against replica failure: AlwaysSpeculatingReadExecutor will always send a request to one extra replica, while SpeculatingReadExecutor will wait until it looks like the original request is in danger of timing out before performing extra reads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractReadExecutor.NeverSpeculatingReadExecutor
-
Field Summary
Fields Modifier and Type Field Description protected ColumnFamilyStore
cfs
protected ReadCommand
command
protected DigestResolver<EndpointsForToken,ReplicaPlan.ForTokenRead>
digestResolver
protected ReadCallback<EndpointsForToken,ReplicaPlan.ForTokenRead>
handler
protected ReadRepair<EndpointsForToken,ReplicaPlan.ForTokenRead>
readRepair
protected Dispatcher.RequestTime
requestTime
protected PartitionIterator
result
protected TraceState
traceState
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
awaitReadRepair()
void
awaitResponses()
void
awaitResponses(boolean logBlockingReadRepairAttempt)
Wait for the CL to be satisfied by responsesvoid
executeAsync()
send the initial set of requestsDecoratedKey
getKey()
static AbstractReadExecutor
getReadExecutor(SinglePartitionReadCommand command, ConsistencyLevel consistencyLevel, Dispatcher.RequestTime requestTime)
ReadRepair<EndpointsForToken,ReplicaPlan.ForTokenRead>
getReadRepair()
PartitionIterator
getResult()
boolean
hasLocalRead()
protected void
makeDigestRequests(java.lang.Iterable<Replica> replicas)
protected void
makeFullDataRequests(ReplicaCollection<?> replicas)
protected void
makeTransientDataRequests(java.lang.Iterable<Replica> replicas)
void
maybeSendAdditionalDataRequests()
abstract void
maybeTryAdditionalReplicas()
Perform additional requests if it looks like the original will time out.void
setResult(PartitionIterator result)
-
-
-
Field Detail
-
command
protected final ReadCommand command
-
readRepair
protected final ReadRepair<EndpointsForToken,ReplicaPlan.ForTokenRead> readRepair
-
digestResolver
protected final DigestResolver<EndpointsForToken,ReplicaPlan.ForTokenRead> digestResolver
-
handler
protected final ReadCallback<EndpointsForToken,ReplicaPlan.ForTokenRead> handler
-
traceState
protected final TraceState traceState
-
cfs
protected final ColumnFamilyStore cfs
-
requestTime
protected final Dispatcher.RequestTime requestTime
-
result
protected volatile PartitionIterator result
-
-
Method Detail
-
getKey
public DecoratedKey getKey()
-
getReadRepair
public ReadRepair<EndpointsForToken,ReplicaPlan.ForTokenRead> getReadRepair()
-
makeFullDataRequests
protected void makeFullDataRequests(ReplicaCollection<?> replicas)
-
makeTransientDataRequests
protected void makeTransientDataRequests(java.lang.Iterable<Replica> replicas)
-
makeDigestRequests
protected void makeDigestRequests(java.lang.Iterable<Replica> replicas)
-
maybeTryAdditionalReplicas
public abstract void maybeTryAdditionalReplicas()
Perform additional requests if it looks like the original will time out. May block while it waits to see if the original requests are answered first.
-
executeAsync
public void executeAsync()
send the initial set of requests
-
getReadExecutor
public static AbstractReadExecutor getReadExecutor(SinglePartitionReadCommand command, ConsistencyLevel consistencyLevel, Dispatcher.RequestTime requestTime) throws UnavailableException
- Returns:
- an executor appropriate for the configured speculative read policy
- Throws:
UnavailableException
-
hasLocalRead
public boolean hasLocalRead()
-
setResult
public void setResult(PartitionIterator result)
-
awaitResponses
public void awaitResponses() throws ReadTimeoutException
- Throws:
ReadTimeoutException
-
awaitResponses
public void awaitResponses(boolean logBlockingReadRepairAttempt) throws ReadTimeoutException
Wait for the CL to be satisfied by responses- Throws:
ReadTimeoutException
-
awaitReadRepair
public void awaitReadRepair() throws ReadTimeoutException
- Throws:
ReadTimeoutException
-
maybeSendAdditionalDataRequests
public void maybeSendAdditionalDataRequests()
-
getResult
public PartitionIterator getResult() throws ReadFailureException, ReadTimeoutException
-
-