You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2011/11/29 19:34:08 UTC

svn commit: r1208012 - in /cassandra/branches/cassandra-1.0.5: CHANGES.txt src/java/org/apache/cassandra/service/StorageProxy.java

Author: slebresne
Date: Tue Nov 29 18:34:07 2011
New Revision: 1208012

URL: http://svn.apache.org/viewvc?rev=1208012&view=rev
Log:
Commit #3539 to 1.0.5 branch

Modified:
    cassandra/branches/cassandra-1.0.5/CHANGES.txt
    cassandra/branches/cassandra-1.0.5/src/java/org/apache/cassandra/service/StorageProxy.java

Modified: cassandra/branches/cassandra-1.0.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.5/CHANGES.txt?rev=1208012&r1=1208011&r2=1208012&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.5/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0.5/CHANGES.txt Tue Nov 29 18:34:07 2011
@@ -1,5 +1,6 @@
 1.0.5
   * revert CASSANDRA-3407 (see CASSANDRA-3540)
+  * fix assertion error while forwarding writes to local nodes (CASSANDRA-3539)
 
 1.0.4
  * fix self-hinting of timed out read repair updates and make hinted handoff

Modified: cassandra/branches/cassandra-1.0.5/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.5/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1208012&r1=1208011&r2=1208012&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.5/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ cassandra/branches/cassandra-1.0.5/src/java/org/apache/cassandra/service/StorageProxy.java Tue Nov 29 18:34:07 2011
@@ -411,14 +411,17 @@ public class StorageProxy implements Sto
                     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.
-                    FastByteArrayOutputStream bos = new FastByteArrayOutputStream();
-                    DataOutputStream dos = new DataOutputStream(bos);
-                    while (iter.hasNext())
+                    if (iter.hasNext())
                     {
-                        InetAddress destination = iter.next();
-                        dos.write(destination.getAddress());
+                        FastByteArrayOutputStream bos = new FastByteArrayOutputStream();
+                        DataOutputStream dos = new DataOutputStream(bos);
+                        while (iter.hasNext())
+                        {
+                            InetAddress destination = iter.next();
+                            dos.write(destination.getAddress());
+                        }
+                        message = message.withHeaderAdded(RowMutation.FORWARD_HEADER, bos.toByteArray());
                     }
-                    message = message.withHeaderAdded(RowMutation.FORWARD_HEADER, bos.toByteArray());
                     // send the combined message + forward headers
                     MessagingService.instance().sendRR(message, target, handler);
                 }