cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r775361 - /incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
Date Fri, 15 May 2009 21:37:46 GMT
Author: jbellis
Date: Fri May 15 21:37:45 2009
New Revision: 775361

URL: http://svn.apache.org/viewvc?rev=775361&view=rev
Log:
check for enough endpoints before starting a quorum wait.
patch by jbellis; reviewed by Jun Rao and Sandeep Tata for CASSANDRA-180

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=775361&r1=775360&r2=775361&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Fri
May 15 21:37:45 2009
@@ -149,12 +149,15 @@
         }
         try
         {
+            EndPoint[] endpoints = StorageService.instance().getNStorageEndPoint(rm.key());
+            if (endpoints.length < (DatabaseDescriptor.getReplicationFactor() / 2) + 1)
+            {
+                throw new UnavailableException();
+            }
             QuorumResponseHandler<Boolean> quorumResponseHandler = new QuorumResponseHandler<Boolean>(
                     DatabaseDescriptor.getReplicationFactor(),
                     new WriteResponseResolver());
-            EndPoint[] endpoints = StorageService.instance().getNStorageEndPoint(rm.key());
             logger.debug("insertBlocking writing key " + rm.key() + " to " + message.getMessageId()
+ "@[" + StringUtils.join(endpoints, ", ") + "]");
-            // TODO: throw a thrift exception if we do not have N nodes
 
             MessagingService.getMessagingInstance().sendRR(message, endpoints, quorumResponseHandler);
             if (!quorumResponseHandler.get())



Mime
View raw message