mirror of https://github.com/apache/cassandra
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
This commit is contained in:
parent
54c1675263
commit
c75abc8e56
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ protocol Cassandra {
|
|||
}
|
||||
|
||||
enum ConsistencyLevel {
|
||||
ONE, QUORUM, DCQUORUM, DCQUORUMSYNC, ALL
|
||||
ONE, QUORUM, LOCAL_QUORUM, EACH_QUORUM, ALL
|
||||
}
|
||||
|
||||
error InvalidRequestException {
|
||||
|
|
|
|||
|
|
@ -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 <ReplicationFactor> / 2 + 1 nodes
|
||||
* DCQUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy)
|
||||
* DCQUORUMSYNC Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy)
|
||||
* LOCAL_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy)
|
||||
* EACH_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy)
|
||||
* ALL Ensure that the write is written to <code><ReplicationFactor></code> 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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <ReplicationFactor> / 2 + 1 nodes
|
||||
* DCQUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy)
|
||||
* DCQUORUMSYNC Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy)
|
||||
* LOCAL_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy)
|
||||
* EACH_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy)
|
||||
* ALL Ensure that the write is written to <code><ReplicationFactor></code> 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:
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<InetAddress> writeEndpoints, Multimap<InetAddress, InetAddress> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<InetAddress> writeEndpoints, Multimap<InetAddress, InetAddress> hintedEndpoints, ConsistencyLevel consistencyLevel, String table)
|
||||
{
|
||||
super(writeEndpoints, hintedEndpoints, consistencyLevel, table);
|
||||
assert consistencyLevel == ConsistencyLevel.DCQUORUM;
|
||||
assert consistencyLevel == ConsistencyLevel.LOCAL_QUORUM;
|
||||
}
|
||||
|
||||
public static IWriteResponseHandler create(Collection<InetAddress> writeEndpoints, Multimap<InetAddress, InetAddress> hintedEndpoints, ConsistencyLevel consistencyLevel, String table)
|
||||
|
|
|
|||
Loading…
Reference in New Issue