From c75abc8e568bbd38f9d9336cecee7c7975562e19 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Mon, 25 Oct 2010 16:00:56 +0000 Subject: [PATCH] renamed CL.DCQUORUM to LOCAL_QUORUM and DCQUORUMSYNCto EACH_QUORUM. patch by jbellis git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1027174 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + interface/cassandra.genavro | 2 +- interface/cassandra.thrift | 14 +++++++------- .../cassandra/thrift/ConsistencyLevel.java | 16 ++++++++-------- .../org/apache/cassandra/thrift/Constants.java | 2 +- .../apache/cassandra/avro/CassandraServer.java | 4 ++-- .../locator/NetworkTopologyStrategy.java | 12 ++++++------ .../DatacenterSyncWriteResponseHandler.java | 4 ++-- .../service/DatacenterWriteResponseHandler.java | 4 ++-- 9 files changed, 30 insertions(+), 29 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8fb471a2d3..eec904ac81 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -58,6 +58,7 @@ * fix commitlog recovery deleting the newly-created segment as well as the old ones (CASSANDRA-1644) * upgrade to Thrift 0.5 (CASSANDRA-1367) + * renamed CL.DCQUORUM to LOCAL_QUORUM and DCQUORUMSYNC to EACH_QUORUM 0.7-beta2 diff --git a/interface/cassandra.genavro b/interface/cassandra.genavro index 6bfe7a7d4d..a53ec1fb92 100644 --- a/interface/cassandra.genavro +++ b/interface/cassandra.genavro @@ -194,7 +194,7 @@ protocol Cassandra { } enum ConsistencyLevel { - ONE, QUORUM, DCQUORUM, DCQUORUMSYNC, ALL + ONE, QUORUM, LOCAL_QUORUM, EACH_QUORUM, ALL } error InvalidRequestException { diff --git a/interface/cassandra.thrift b/interface/cassandra.thrift index 549af4ea0b..efeb0da4b8 100644 --- a/interface/cassandra.thrift +++ b/interface/cassandra.thrift @@ -46,7 +46,7 @@ namespace rb CassandraThrift # for every edit that doesn't result in a change to major/minor. # # See the Semantic Versioning Specification (SemVer) http://semver.org. -const string VERSION = "19.3.0" +const string VERSION = "19.4.0" # @@ -142,23 +142,23 @@ exception AuthorizationException { * ANY Ensure that the write has been written once somewhere, including possibly being hinted in a non-target node. * ONE Ensure that the write has been written to at least 1 node's commit log and memory table * QUORUM Ensure that the write has been written to / 2 + 1 nodes - * DCQUORUM Ensure that the write has been written to / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) - * DCQUORUMSYNC Ensure that the write has been written to / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) + * LOCAL_QUORUM Ensure that the write has been written to / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) + * EACH_QUORUM Ensure that the write has been written to / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) * ALL Ensure that the write is written to <ReplicationFactor> nodes before responding to the client. * * Read: * ANY Not supported. You probably want ONE instead. * ONE Will return the record returned by the first node to respond. A consistency check is always done in a background thread to fix any consistency issues when ConsistencyLevel.ONE is used. This means subsequent calls will have correct data even if the initial read gets an older value. (This is called 'read repair'.) * QUORUM Will query all storage nodes and return the record with the most recent timestamp once it has at least a majority of replicas reported. Again, the remaining replicas will be checked in the background. - * DCQUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied. - * DCQUORUMSYNC Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied. + * LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied. + * EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied. * ALL Queries all storage nodes and returns the record with the most recent timestamp. */ enum ConsistencyLevel { ONE = 1, QUORUM = 2, - DCQUORUM = 3, - DCQUORUMSYNC = 4, + LOCAL_QUORUM = 3, + EACH_QUORUM = 4, ALL = 5, ANY = 6, } diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java index 8411864801..a4087a5d7f 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/ConsistencyLevel.java @@ -44,23 +44,23 @@ import org.apache.thrift.TEnum; * ANY Ensure that the write has been written once somewhere, including possibly being hinted in a non-target node. * ONE Ensure that the write has been written to at least 1 node's commit log and memory table * QUORUM Ensure that the write has been written to / 2 + 1 nodes - * DCQUORUM Ensure that the write has been written to / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) - * DCQUORUMSYNC Ensure that the write has been written to / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) + * LOCAL_QUORUM Ensure that the write has been written to / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) + * EACH_QUORUM Ensure that the write has been written to / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) * ALL Ensure that the write is written to <ReplicationFactor> nodes before responding to the client. * * Read: * ANY Not supported. You probably want ONE instead. * ONE Will return the record returned by the first node to respond. A consistency check is always done in a background thread to fix any consistency issues when ConsistencyLevel.ONE is used. This means subsequent calls will have correct data even if the initial read gets an older value. (This is called 'read repair'.) * QUORUM Will query all storage nodes and return the record with the most recent timestamp once it has at least a majority of replicas reported. Again, the remaining replicas will be checked in the background. - * DCQUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied. - * DCQUORUMSYNC Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied. + * LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied. + * EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied. * ALL Queries all storage nodes and returns the record with the most recent timestamp. */ public enum ConsistencyLevel implements TEnum { ONE(1), QUORUM(2), - DCQUORUM(3), - DCQUORUMSYNC(4), + LOCAL_QUORUM(3), + EACH_QUORUM(4), ALL(5), ANY(6); @@ -88,9 +88,9 @@ public enum ConsistencyLevel implements TEnum { case 2: return QUORUM; case 3: - return DCQUORUM; + return LOCAL_QUORUM; case 4: - return DCQUORUMSYNC; + return EACH_QUORUM; case 5: return ALL; case 6: diff --git a/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java b/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java index b9d9eacc4f..a45c2d76ac 100644 --- a/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java +++ b/interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java @@ -44,6 +44,6 @@ import org.slf4j.LoggerFactory; public class Constants { - public static final String VERSION = "19.3.0"; + public static final String VERSION = "19.4.0"; } diff --git a/src/java/org/apache/cassandra/avro/CassandraServer.java b/src/java/org/apache/cassandra/avro/CassandraServer.java index 960e6cf867..325d3aa6db 100644 --- a/src/java/org/apache/cassandra/avro/CassandraServer.java +++ b/src/java/org/apache/cassandra/avro/CassandraServer.java @@ -591,8 +591,8 @@ public class CassandraServer implements Cassandra { { case ONE: return org.apache.cassandra.thrift.ConsistencyLevel.ONE; case QUORUM: return org.apache.cassandra.thrift.ConsistencyLevel.QUORUM; - case DCQUORUM: return org.apache.cassandra.thrift.ConsistencyLevel.DCQUORUM; - case DCQUORUMSYNC: return org.apache.cassandra.thrift.ConsistencyLevel.DCQUORUMSYNC; + case LOCAL_QUORUM: return org.apache.cassandra.thrift.ConsistencyLevel.LOCAL_QUORUM; + case EACH_QUORUM: return org.apache.cassandra.thrift.ConsistencyLevel.EACH_QUORUM; case ALL: return org.apache.cassandra.thrift.ConsistencyLevel.ALL; } return null; diff --git a/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java b/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java index 5e0c454942..9ac7ca4538 100644 --- a/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java +++ b/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java @@ -142,19 +142,19 @@ public class NetworkTopologyStrategy extends AbstractReplicationStrategy /** * This method will generate the QRH object and returns. If the Consistency - * level is DCQUORUM then it will return a DCQRH with a map of local rep - * factor alone. If the consistency level is DCQUORUMSYNC then it will + * level is LOCAL_QUORUM then it will return a DCQRH with a map of local rep + * factor alone. If the consistency level is EACH_QUORUM then it will * return a DCQRH with a map of all the DC rep factor. */ @Override public IWriteResponseHandler getWriteResponseHandler(Collection writeEndpoints, Multimap hintedEndpoints, ConsistencyLevel consistency_level) { - if (consistency_level == ConsistencyLevel.DCQUORUM) + if (consistency_level == ConsistencyLevel.LOCAL_QUORUM) { // block for in this context will be localnodes block. return DatacenterWriteResponseHandler.create(writeEndpoints, hintedEndpoints, consistency_level, table); } - else if (consistency_level == ConsistencyLevel.DCQUORUMSYNC) + else if (consistency_level == ConsistencyLevel.EACH_QUORUM) { return DatacenterSyncWriteResponseHandler.create(writeEndpoints, hintedEndpoints, consistency_level, table); } @@ -163,12 +163,12 @@ public class NetworkTopologyStrategy extends AbstractReplicationStrategy /** * This method will generate the WRH object and returns. If the Consistency - * level is DCQUORUM/DCQUORUMSYNC then it will return a DCQRH. + * level is LOCAL_QUORUM/EACH_QUORUM then it will return a DCQRH. */ @Override public QuorumResponseHandler getQuorumResponseHandler(IResponseResolver responseResolver, ConsistencyLevel consistencyLevel) { - if (consistencyLevel.equals(ConsistencyLevel.DCQUORUM) || consistencyLevel.equals(ConsistencyLevel.DCQUORUMSYNC)) + if (consistencyLevel.equals(ConsistencyLevel.LOCAL_QUORUM) || consistencyLevel.equals(ConsistencyLevel.EACH_QUORUM)) { return new DatacenterQuorumResponseHandler(responseResolver, consistencyLevel, table); } diff --git a/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java b/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java index f5138fba0b..9264140b69 100644 --- a/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java +++ b/src/java/org/apache/cassandra/service/DatacenterSyncWriteResponseHandler.java @@ -42,7 +42,7 @@ import com.google.common.collect.Multimap; import org.apache.cassandra.utils.FBUtilities; /** - * This class blocks for a quorum of responses _in all datacenters_ (CL.DCQUORUMSYNC). + * This class blocks for a quorum of responses _in all datacenters_ (CL.EACH_QUORUM). */ public class DatacenterSyncWriteResponseHandler extends AbstractWriteResponseHandler { @@ -61,7 +61,7 @@ public class DatacenterSyncWriteResponseHandler extends AbstractWriteResponseHan { // Response is been managed by the map so make it 1 for the superclass. super(writeEndpoints, hintedEndpoints, consistencyLevel); - assert consistencyLevel == ConsistencyLevel.DCQUORUM; + assert consistencyLevel == ConsistencyLevel.LOCAL_QUORUM; strategy = (NetworkTopologyStrategy) Table.open(table).replicationStrategy; diff --git a/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java b/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java index badc969b66..4719f5c488 100644 --- a/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java +++ b/src/java/org/apache/cassandra/service/DatacenterWriteResponseHandler.java @@ -39,7 +39,7 @@ import org.apache.cassandra.utils.FBUtilities; import com.google.common.collect.Multimap; /** - * This class blocks for a quorum of responses _in the local datacenter only_ (CL.DCQUORUM). + * This class blocks for a quorum of responses _in the local datacenter only_ (CL.LOCAL_QUORUM). */ public class DatacenterWriteResponseHandler extends WriteResponseHandler { @@ -54,7 +54,7 @@ public class DatacenterWriteResponseHandler extends WriteResponseHandler protected DatacenterWriteResponseHandler(Collection writeEndpoints, Multimap hintedEndpoints, ConsistencyLevel consistencyLevel, String table) { super(writeEndpoints, hintedEndpoints, consistencyLevel, table); - assert consistencyLevel == ConsistencyLevel.DCQUORUM; + assert consistencyLevel == ConsistencyLevel.LOCAL_QUORUM; } public static IWriteResponseHandler create(Collection writeEndpoints, Multimap hintedEndpoints, ConsistencyLevel consistencyLevel, String table)