cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [3/6] git commit: Allow local batchlog writes for CL.ANY patch by jbellis; reviewed by Aleksey for CASSANDRA-5967
Date Sun, 01 Sep 2013 19:34:55 GMT
Allow local batchlog writes for CL.ANY
patch by jbellis; reviewed by Aleksey for CASSANDRA-5967


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3380fa7b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3380fa7b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3380fa7b

Branch: refs/heads/trunk
Commit: 3380fa7baf76998b7c2fdbcb85b23fa3f0099f7c
Parents: b14273b
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Sun Sep 1 14:34:11 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Sun Sep 1 14:34:11 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                             | 1 +
 src/java/org/apache/cassandra/service/StorageProxy.java | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3380fa7b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1943217..89f66a8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.10
+ * Allow local batchlog writes for CL.ANY (CASSANDRA-5967)
  * Optimize name query performance in wide rows (CASSANDRA-5966)
  * Upgrade metrics-core to version 2.2.0 (CASSANDRA-5947)
  * Add snitch, schema version, cluster, partitioner to JMX (CASSANDRA-5881)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3380fa7b/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index ec27891..94db26d 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -261,7 +261,7 @@ public class StorageProxy implements StorageProxyMBean
             }
 
             // write to the batchlog
-            Collection<InetAddress> batchlogEndpoints = getBatchlogEndpoints(localDataCenter);
+            Collection<InetAddress> batchlogEndpoints = getBatchlogEndpoints(localDataCenter,
consistency_level);
             UUID batchUUID = UUID.randomUUID();
             syncWriteToBatchlog(mutations, batchlogEndpoints, batchUUID);
 
@@ -418,7 +418,7 @@ public class StorageProxy implements StorageProxyMBean
      * - choose min(2, number of qualifying candiates above)
      * - allow the local node to be the only replica only if it's a single-node cluster
      */
-    private static Collection<InetAddress> getBatchlogEndpoints(String localDataCenter)
throws UnavailableException
+    private static Collection<InetAddress> getBatchlogEndpoints(String localDataCenter,
ConsistencyLevel consistencyLevel) throws UnavailableException
     {
         // will include every known node in the DC, including localhost.
         TokenMetadata.Topology topology = StorageService.instance.getTokenMetadata().cloneOnlyTokenMap().getTopology();
@@ -440,7 +440,12 @@ public class StorageProxy implements StorageProxyMBean
         }
 
         if (candidates.isEmpty())
+        {
+            if (consistencyLevel == ConsistencyLevel.ANY)
+                return Collections.singleton(FBUtilities.getBroadcastAddress());
+
             throw new UnavailableException(ConsistencyLevel.ONE, 1, 0);
+        }
 
         if (candidates.size() > 2)
         {


Mime
View raw message