cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1081924 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/WriteResponseHandler.java
Date Tue, 15 Mar 2011 20:09:25 GMT
Author: jbellis
Date: Tue Mar 15 20:09:25 2011
New Revision: 1081924

URL: http://svn.apache.org/viewvc?rev=1081924&view=rev
Log:
r/m obsolete assert
patch by jbellis; reviewed by Peter Schuller for CASSANDRA-2013

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

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/WriteResponseHandler.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/WriteResponseHandler.java?rev=1081924&r1=1081923&r2=1081924&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/WriteResponseHandler.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/WriteResponseHandler.java
Tue Mar 15 20:09:25 2011
@@ -74,36 +74,23 @@ public class WriteResponseHandler extend
 
     protected int determineBlockFor(String table)
     {
-        int blockFor = 0;
         switch (consistencyLevel)
         {
             case ONE:
-                blockFor = 1;
-                break;
+                return 1;
             case ANY:
-                blockFor = 1;
-                break;
+                return 1;
             case TWO:
-                blockFor = 2;
-                break;
+                return 2;
             case THREE:
-                blockFor = 3;
-                break;
+                return 3;
             case QUORUM:
-                blockFor = (writeEndpoints.size() / 2) + 1;
-                break;
+                return (writeEndpoints.size() / 2) + 1;
             case ALL:
-                blockFor = writeEndpoints.size();
-                break;
+                return writeEndpoints.size();
             default:
                 throw new UnsupportedOperationException("invalid consistency level: " + consistencyLevel.toString());
         }
-        // at most one node per range can bootstrap at a time, and these will be added to
the write until
-        // bootstrap finishes (at which point we no longer need to write to the old ones).
-        assert 1 <= blockFor && blockFor <= 2 * Table.open(table).getReplicationStrategy().getReplicationFactor()
-            : String.format("invalid response count %d for replication factor %d",
-                            blockFor, Table.open(table).getReplicationStrategy().getReplicationFactor());
-        return blockFor;
     }
 
     public void assureSufficientLiveNodes() throws UnavailableException



Mime
View raw message