From 619cbd124d248c8a9e27e9ebb7eaa4e7d8e31046 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Tue, 27 Jul 2010 03:17:10 +0000 Subject: [PATCH] merge from 0.6 git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@979508 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ .../org/apache/cassandra/service/StorageProxy.java | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 3bef09a4c1..1d416bdcc7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -67,6 +67,9 @@ dev * remove gossip message size limit (CASSANDRA-1138) * parallelize local and remote reads during multiget, and respect snitch when determining whether to do local read for CL.ONE (CASSANDRA-1317) + * fix read repair to use requested consistency level on digest mismatch, + rather than assuming QUORUM (CASSANDRA-1316) + 0.6.3 diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 7d25dbb978..582829d869 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -422,8 +422,7 @@ public class StorageProxy implements StorageProxyMBean logger.debug("strongread reading " + (m == message ? "data" : "digest") + " for " + command + " from " + m.getMessageId() + "@" + endpoint); } AbstractReplicationStrategy rs = StorageService.instance.getReplicationStrategy(command.table); - ReadResponseResolver resolver = new ReadResponseResolver(command.table); - QuorumResponseHandler quorumResponseHandler = rs.getQuorumResponseHandler(resolver, consistency_level, command.table); + QuorumResponseHandler quorumResponseHandler = rs.getQuorumResponseHandler(new ReadResponseResolver(command.table), consistency_level, command.table); MessagingService.instance.sendRR(messages, endpoints, quorumResponseHandler); quorumResponseHandlers.add(quorumResponseHandler); commandEndpoints.add(endpoints); @@ -447,10 +446,10 @@ public class StorageProxy implements StorageProxyMBean { if (randomlyReadRepair(command)) { - IResponseResolver resolver = new ReadResponseResolver(command.table); AbstractReplicationStrategy rs = StorageService.instance.getReplicationStrategy(command.table); - QuorumResponseHandler quorumResponseHandlerRepair = rs.getQuorumResponseHandler(resolver, ConsistencyLevel.QUORUM, command.table); - logger.info("DigestMismatchException: " + ex.getMessage()); + QuorumResponseHandler quorumResponseHandlerRepair = rs.getQuorumResponseHandler(new ReadResponseResolver(command.table), ConsistencyLevel.QUORUM, command.table); + if (logger.isDebugEnabled()) + logger.debug("Digest mismatch:", ex); Message messageRepair = command.makeReadMessage(); MessagingService.instance.sendRR(messageRepair, commandEndpoints.get(commandIndex), quorumResponseHandlerRepair); try @@ -461,8 +460,7 @@ public class StorageProxy implements StorageProxyMBean } catch (DigestMismatchException e) { - // TODO should this be a thrift exception? - throw new RuntimeException("digest mismatch reading key " + FBUtilities.bytesToHex(command.key), e); + throw new AssertionError(e); // full data requested from each node here, no digests should be sent } } }