Author: jbellis
Date: Mon Jan 24 15:17:29 2011
New Revision: 1062823
URL: http://svn.apache.org/viewvc?rev=1062823&view=rev
Log:
fix merge
Modified:
cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
Modified:
cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1062823&r1=1062822&r2=1062823&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Mon
Jan 24 15:17:29 2011
@@ -385,7 +385,7 @@ public class StorageProxy implements Sto
for (CounterMutation cm : mutations)
{
mostRecentMutation = cm;
- InetAddress endpoint = ss.findSuitableEndpoint(cm.getTable(),
cm.key());
+ InetAddress endpoint = findSuitableEndpoint(cm.getTable(),
cm.key());
if (endpoint.equals(FBUtilities.getLocalAddress()))
{
@@ -430,6 +430,15 @@ public class StorageProxy implements Sto
}
}
+ private static InetAddress findSuitableEndpoint(String table, ByteBuffer
key) throws UnavailableException
+ {
+ List<InetAddress> endpoints =
StorageService.instance.getLiveNaturalEndpoints(table, key);
+
DatabaseDescriptor.getEndpointSnitch().sortByProximity(FBUtilities.getLocalAddress(),
endpoints);
+ if (endpoints.isEmpty())
+ throw new UnavailableException();
+ return endpoints.get(0);
+ }
+
// Must be called on a replica of the mutation. This replica becomes the
// leader of this mutation.
public static void applyCounterMutationOnLeader(CounterMutation cm) throws
UnavailableException, TimeoutException, IOException