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 17:58:24 UTC

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

Author: slebresne
Date: Tue Nov 29 16:58:23 2011
New Revision: 1207969

URL: http://svn.apache.org/viewvc?rev=1207969&view=rev
Log:
Fix assertion error while forwarding writes to local nodes
patch by slebresne; reviewed by jbellis for CASSANDRA-3539

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

Modified: cassandra/branches/cassandra-1.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/CHANGES.txt?rev=1207969&r1=1207968&r2=1207969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0/CHANGES.txt Tue Nov 29 16:58:23 2011
@@ -1,6 +1,7 @@
 1.0.5
  * add command to stop compactions (CASSANDRA-1740)
  * filter out unavailable cipher suites when using encryption (CASSANDRA-3178)
+ * fix assertion error when forwarding 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/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1207969&r1=1207968&r2=1207969&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageProxy.java Tue Nov 29 16:58:23 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);
                 }