public void compareResponses() throws DigestMismatchException { long start = System.nanoTime(); // validate digests against each other; throw immediately on mismatch. ByteBuffer digest = null; for (MessageIn<ReadResponse> message : responses) { ReadResponse response = message.payload; ByteBuffer newDigest = response.digest(command); if (digest == null) digest = newDigest; else if (!digest.equals(newDigest)) // rely on the fact that only single partition queries use digests throw new DigestMismatchException(((SinglePartitionReadCommand)command).partitionKey(), digest, newDigest); } if (logger.isTraceEnabled()) logger.trace("resolve: {} ms.", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)); }
public void run() { // If the resolver is a DigestResolver, we need to do a full data read if there is a mismatch. // Otherwise, resolve will send the repairs directly if needs be (and in that case we should never // get a digest mismatch). try { resolver.compareResponses(); } catch (DigestMismatchException e) { assert resolver instanceof DigestResolver; if (traceState != null) traceState.trace("Digest mismatch: {}", e.toString()); if (logger.isDebugEnabled()) logger.debug("Digest mismatch:", e); ReadRepairMetrics.repairedBackground.mark(); final DataResolver repairResolver = new DataResolver(keyspace, command, consistencyLevel, endpoints.size(), queryStartNanoTime); AsyncRepairCallback repairHandler = new AsyncRepairCallback(repairResolver, endpoints.size()); for (InetAddress endpoint : endpoints) { MessageOut<ReadCommand> message = command.createMessage(MessagingService.instance().getVersion(endpoint)); MessagingService.instance().sendRR(message, endpoint, repairHandler); } } } }
public void run() { // If the resolver is a DigestResolver, we need to do a full data read if there is a mismatch. // Otherwise, resolve will send the repairs directly if needs be (and in that case we should never // get a digest mismatch). try { resolver.compareResponses(); } catch (DigestMismatchException e) { assert resolver instanceof DigestResolver; if (traceState != null) traceState.trace("Digest mismatch: {}", e.toString()); if (logger.isDebugEnabled()) logger.debug("Digest mismatch:", e); ReadRepairMetrics.repairedBackground.mark(); final DataResolver repairResolver = new DataResolver(keyspace, command, consistencyLevel, endpoints.size(), queryStartNanoTime); AsyncRepairCallback repairHandler = new AsyncRepairCallback(repairResolver, endpoints.size()); for (InetAddress endpoint : endpoints) { MessageOut<ReadCommand> message = command.createMessage(MessagingService.instance().getVersion(endpoint)); MessagingService.instance().sendRR(message, endpoint, repairHandler); } } } }
public void compareResponses() throws DigestMismatchException { long start = System.nanoTime(); // validate digests against each other; throw immediately on mismatch. ByteBuffer digest = null; for (MessageIn<ReadResponse> message : responses) { ReadResponse response = message.payload; ByteBuffer newDigest = response.digest(command); if (digest == null) digest = newDigest; else if (!digest.equals(newDigest)) // rely on the fact that only single partition queries use digests throw new DigestMismatchException(((SinglePartitionReadCommand)command).partitionKey(), digest, newDigest); } if (logger.isTraceEnabled()) logger.trace("resolve: {} ms.", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)); }
public void run() { // If the resolver is a DigestResolver, we need to do a full data read if there is a mismatch. // Otherwise, resolve will send the repairs directly if needs be (and in that case we should never // get a digest mismatch). try { resolver.compareResponses(); } catch (DigestMismatchException e) { assert resolver instanceof DigestResolver; if (traceState != null) traceState.trace("Digest mismatch: {}", e.toString()); if (logger.isDebugEnabled()) logger.debug("Digest mismatch:", e); ReadRepairMetrics.repairedBackground.mark(); final DataResolver repairResolver = new DataResolver(keyspace, command, consistencyLevel, endpoints.size(), queryStartNanoTime); AsyncRepairCallback repairHandler = new AsyncRepairCallback(repairResolver, endpoints.size()); for (InetAddress endpoint : endpoints) { MessageOut<ReadCommand> message = command.createMessage(MessagingService.instance().getVersion(endpoint)); MessagingService.instance().sendRR(message, endpoint, repairHandler); } } } }
public void compareResponses() throws DigestMismatchException { long start = System.nanoTime(); // validate digests against each other; throw immediately on mismatch. ByteBuffer digest = null; for (MessageIn<ReadResponse> message : responses) { ReadResponse response = message.payload; ByteBuffer newDigest = response.digest(command); if (digest == null) digest = newDigest; else if (!digest.equals(newDigest)) // rely on the fact that only single partition queries use digests throw new DigestMismatchException(((SinglePartitionReadCommand)command).partitionKey(), digest, newDigest); } if (logger.isTraceEnabled()) logger.trace("resolve: {} ms.", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)); }
digest = newDigest; else if (!digest.equals(newDigest)) throw new DigestMismatchException(key, digest, newDigest);