use of voldemort.store.routed.action.GetAllReadRepair in project voldemort by voldemort.
the class PipelineRoutedStore method getAll.
public Map<ByteArray, List<Versioned<byte[]>>> getAll(Iterable<ByteArray> keys, Map<ByteArray, byte[]> transforms, long getAllOpTimeoutInMs) throws VoldemortException {
StoreUtils.assertValidKeys(keys);
long startTimeMs = -1;
long startTimeNs = -1;
if (logger.isDebugEnabled()) {
startTimeMs = System.currentTimeMillis();
startTimeNs = System.nanoTime();
}
boolean allowReadRepair = repairReads && (transforms == null || transforms.size() == 0);
GetAllPipelineData pipelineData = new GetAllPipelineData();
if (zoneRoutingEnabled)
pipelineData.setZonesRequired(storeDef.getZoneCountReads());
else
pipelineData.setZonesRequired(null);
pipelineData.setStats(stats);
Pipeline pipeline = new Pipeline(Operation.GET_ALL, getAllOpTimeoutInMs, TimeUnit.MILLISECONDS);
pipeline.addEventAction(Event.STARTED, new GetAllConfigureNodes(pipelineData, Event.CONFIGURED, failureDetector, storeDef.getPreferredReads(), storeDef.getRequiredReads(), routingStrategy, keys, transforms, clientZone, zoneAffinity));
pipeline.addEventAction(Event.CONFIGURED, new PerformParallelGetAllRequests(pipelineData, Event.INSUFFICIENT_SUCCESSES, failureDetector, getAllOpTimeoutInMs, nonblockingStores));
pipeline.addEventAction(Event.INSUFFICIENT_SUCCESSES, new PerformSerialGetAllRequests(pipelineData, allowReadRepair ? Event.RESPONSES_RECEIVED : Event.COMPLETED, keys, failureDetector, innerStores, storeDef.getPreferredReads(), storeDef.getRequiredReads(), timeoutConfig.isPartialGetAllAllowed()));
if (allowReadRepair)
pipeline.addEventAction(Event.RESPONSES_RECEIVED, new GetAllReadRepair(pipelineData, Event.COMPLETED, storeDef.getPreferredReads(), getAllOpTimeoutInMs, nonblockingStores, readRepairer));
pipeline.addEvent(Event.STARTED);
if (logger.isDebugEnabled()) {
StringBuilder keyStr = new StringBuilder();
for (ByteArray key : keys) {
keyStr.append(ByteUtils.toHexString(key.get()) + ",");
}
logger.debug("Operation " + pipeline.getOperation().getSimpleName() + " Keys " + keyStr.toString());
}
try {
pipeline.execute();
} catch (VoldemortException e) {
stats.reportException(e);
throw e;
}
if (pipelineData.getFatalError() != null)
throw pipelineData.getFatalError();
if (logger.isDebugEnabled()) {
logger.debug("Finished " + pipeline.getOperation().getSimpleName() + "for keys " + ByteArray.toHexStrings(keys) + " keyRef: " + System.identityHashCode(keys) + "; started at " + startTimeMs + " took " + (System.nanoTime() - startTimeNs) + " values: " + formatNodeValuesFromGetAll(pipelineData.getResponses()));
}
return pipelineData.getResult();
}
Aggregations