You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/08/30 00:39:58 UTC

svn commit: r809216 - /incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java

Author: jbellis
Date: Sat Aug 29 22:39:58 2009
New Revision: 809216

URL: http://svn.apache.org/viewvc?rev=809216&view=rev
Log:
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

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=809216&r1=809215&r2=809216&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Sat Aug 29 22:39:58 2009
@@ -112,29 +112,16 @@
         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<EndPoint, EndPoint> endpointMap = StorageService.instance().getNStorageEndPointMap(rm.key());
-			// TODO: throw a thrift exception if we do not have N nodes
 			Map<EndPoint, Message> messageMap = createWriteMessages(rm, endpointMap);
 			for (Map.Entry<EndPoint, Message> 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)