cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: inline sendMessages
Date Wed, 22 May 2013 16:03:40 GMT
Updated Branches:
  refs/heads/trunk 44827b4a8 -> 369936c2c


inline sendMessages


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/369936c2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/369936c2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/369936c2

Branch: refs/heads/trunk
Commit: 369936c2c3f67b3023c2f33620f2f26ad7b70539
Parents: 44827b4
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed May 22 11:03:36 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed May 22 11:03:36 2013 -0500

----------------------------------------------------------------------
 .../org/apache/cassandra/service/StorageProxy.java |   37 ++++++--------
 1 files changed, 16 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/369936c2/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index 3c2b8a5..0e49854 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -763,7 +763,22 @@ public class StorageProxy implements StorageProxyMBean
         }
 
         if (dcMessages != null)
-            sendMessages(localDataCenter, dcMessages, responseHandler);
+        {
+            // for each datacenter, send a message to one node to relay the write to other
replicas
+            for (Map.Entry<String, Multimap<MessageOut, InetAddress>> entry:
dcMessages.entrySet())
+            {
+                boolean isLocalDC = entry.getKey().equals(localDataCenter);
+                for (Map.Entry<MessageOut, Collection<InetAddress>> messages:
entry.getValue().asMap().entrySet())
+                {
+                    MessageOut message = messages.getKey();
+                    Collection<InetAddress> targets1 = messages.getValue();
+                    // a single message object is used for unhinted writes, so clean out
any forwards
+                    // from previous loop iterations
+                    message = message.withHeaderRemoved(RowMutation.FORWARD_TO);
+                    sendMessagesToOneDC(message, targets1, isLocalDC, responseHandler);
+                }
+            }
+        }
     }
 
     public static Future<Void> submitHint(final RowMutation mutation,
@@ -813,26 +828,6 @@ public class StorageProxy implements StorageProxyMBean
         totalHints.incrementAndGet();
     }
 
-    /**
-     * for each datacenter, send a message to one node to relay the write to other replicas
-     */
-    private static void sendMessages(String localDataCenter, Map<String, Multimap<MessageOut,
InetAddress>> dcMessages, AbstractWriteResponseHandler handler)
-    {
-        for (Map.Entry<String, Multimap<MessageOut, InetAddress>> entry: dcMessages.entrySet())
-        {
-            boolean isLocalDC = entry.getKey().equals(localDataCenter);
-            for (Map.Entry<MessageOut, Collection<InetAddress>> messages: entry.getValue().asMap().entrySet())
-            {
-                MessageOut message = messages.getKey();
-                Collection<InetAddress> targets = messages.getValue();
-                // a single message object is used for unhinted writes, so clean out any
forwards
-                // from previous loop iterations
-                message = message.withHeaderRemoved(RowMutation.FORWARD_TO);
-                sendMessagesToOneDC(message, targets, isLocalDC, handler);
-            }
-        }
-    }
-
     private static void sendMessagesToOneDC(MessageOut message, Collection<InetAddress>
targets, boolean localDC, AbstractWriteResponseHandler handler)
     {
         Iterator<InetAddress> iter = targets.iterator();


Mime
View raw message