remove nonlocal DC write optimization
patch by Vijay; reviewed by jbellis for CASSANDRA-3577

git-svn-id: 
https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.8@1210902 
13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/trunk
Commit: 8480f06e324e0bc2e042b7c1c483e08132d81eb4
Parents: 41ef1b5
Author: Jonathan Ellis <[email protected]>
Authored: Tue Dec 6 13:28:33 2011 +0000
Committer: Jonathan Ellis <[email protected]>
Committed: Tue Dec 6 13:28:33 2011 +0000

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 +
 .../org/apache/cassandra/service/StorageProxy.java |   36 ++-------------
 2 files changed, 6 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8480f06e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e7b7d9d..c93a6de 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,7 @@
 0.8.9
  * use cannonical host for local node in nodetool info (CASSANDRA-3556)
+ * remove nonlocal DC write optimization since it only worked with
+   CL.ONE or CL.LOCAL_QUORUM (CASSANDRA-3577)
 
 
 0.8.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8480f06e/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 153744a..e78c175 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -296,8 +296,6 @@ public class StorageProxy implements StorageProxyMBean
     {
         for (Map.Entry<String, Multimap<Message, InetAddress>> entry: 
dcMessages.entrySet())
         {
-            String dataCenter = entry.getKey();
-
             // send the messages corresponding to this datacenter
             for (Map.Entry<Message, Collection<InetAddress>> messages: 
entry.getValue().asMap().entrySet())
             {
@@ -306,36 +304,10 @@ public class StorageProxy implements StorageProxyMBean
                 // from previous loop iterations
                 message.removeHeader(RowMutation.FORWARD_HEADER);
 
-                if (dataCenter.equals(localDataCenter))
-                {
-                    // direct writes to local DC or old Cassadra versions
-                    for (InetAddress destination : messages.getValue())
-                        MessagingService.instance().sendRR(message, 
destination, handler);
-                }
-                else
-                {
-                    // Non-local DC. First endpoint in list is the destination 
for this group
-                    Iterator<InetAddress> iter = 
messages.getValue().iterator();
-                    InetAddress target = iter.next();
-                    // Add all the other destinations of the same message as a 
header in the primary message.
-                    while (iter.hasNext())
-                    {
-                        InetAddress destination = iter.next();
-                        // group all nodes in this DC as forward headers on 
the primary message
-                        ByteArrayOutputStream bos = new 
ByteArrayOutputStream();
-                        DataOutputStream dos = new DataOutputStream(bos);
-
-                        // append to older addresses
-                        byte[] previousHints = 
message.getHeader(RowMutation.FORWARD_HEADER);
-                        if (previousHints != null)
-                            dos.write(previousHints);
-
-                        dos.write(destination.getAddress());
-                        message.setHeader(RowMutation.FORWARD_HEADER, 
bos.toByteArray());
-                    }
-                    // send the combined message + forward headers
-                    MessagingService.instance().sendRR(message, target, 
handler);
-                }
+                // direct writes to everything -- optimized nonlocal DC writes 
are
+                // postponed to 1.1; see CASSANDRA-3577
+                for (InetAddress destination : messages.getValue())
+                    MessagingService.instance().sendRR(message, destination, 
handler);
             }
         }
     }

Reply via email to