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 2011/01/20 03:34:08 UTC

svn commit: r1061104 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java

Author: jbellis
Date: Thu Jan 20 02:34:07 2011
New Revision: 1061104

URL: http://svn.apache.org/viewvc?rev=1061104&view=rev
Log:
fix messages/endpoints mismatch when RR is disabled
patch by jbellis; reviewed by tjake for CASSANDRA-2010

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1061104&r1=1061103&r2=1061104&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageProxy.java Thu Jan 20 02:34:07 2011
@@ -354,18 +354,17 @@ public class StorageProxy implements Sto
             ReadCallback<Row> handler = getReadCallback(resolver, command.table, consistency_level);
             handler.assureSufficientLiveNodes(endpoints);
 
-            int targets;
+            // if we're not going to read repair, cut the endpoints list down to the ones required to satisfy ConsistencyLevel
             if (randomlyReadRepair(command))
             {
-                targets = endpoints.size();
-                if (targets > handler.blockfor)
+                if (endpoints.size() > handler.blockfor)
                     repairs.add(command);
             }
             else
             {
-                targets = handler.blockfor;
+                endpoints = endpoints.subList(0, handler.blockfor);
             }
-            Message[] messages = new Message[targets];
+            Message[] messages = new Message[endpoints.size()];
 
             // data-request message is sent to dataPoint, the node that will actually get
             // the data for us. The other replicas are only sent a digest query.