From 86abfe10279ce957e3dad221b2ca6e58eea1758d Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Sat, 29 Aug 2009 22:39:58 +0000 Subject: [PATCH] r/m special case of local destination when writing with ConsistencyLevel.ZERO, since it causes blocking for commitlog. (MessagingService still optimizes out the network write/read.) Patch by Chris Goffinet; reviewed by jbellis for CASSANDRA-399 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@809216 13f79535-47bb-0310-9956-ffa450edef68 --- .../cassandra/service/StorageProxy.java | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index f7993b9710..1f0a650298 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -112,29 +112,16 @@ public class StorageProxy implements StorageProxyMBean long startTime = System.currentTimeMillis(); try { + // (This is the ZERO consistency level, so user doesn't care if we don't really have N destinations available.) Map endpointMap = StorageService.instance().getNStorageEndPointMap(rm.key()); - // TODO: throw a thrift exception if we do not have N nodes Map messageMap = createWriteMessages(rm, endpointMap); for (Map.Entry entry : messageMap.entrySet()) { Message message = entry.getValue(); EndPoint endpoint = entry.getKey(); - // Check if local and not hinted - byte[] hintedBytes = message.getHeader(RowMutation.HINT); - if (endpoint.equals(StorageService.getLocalStorageEndPoint()) - && !(hintedBytes!= null && hintedBytes.length>0)) - { - if (logger.isDebugEnabled()) - logger.debug("locally writing writing key " + rm.key() - + " to " + endpoint); - rm.apply(); - } else - { - if (logger.isDebugEnabled()) - logger.debug("insert writing key " + rm.key() + " to " - + message.getMessageId() + "@" + endpoint); - MessagingService.getMessagingInstance().sendOneWay(message, endpoint); - } + if (logger.isDebugEnabled()) + logger.debug("insert writing key " + rm.key() + " to " + message.getMessageId() + "@" + endpoint); + MessagingService.getMessagingInstance().sendOneWay(message, endpoint); } } catch (IOException e)