Database Reference
In-Depth Information
Table7-1.Read consistency levels
Consistency
level
Implication
Unsupported. You cannot specify CL.ZERO for read operations because it doesn't make sense.
This would amount to saying “give me the data from no nodes.”
ZERO
Unsupported. Use CL.ONE instead.
ANY
Immediately return the record held by the first node that responds to the query. A background
thread is created to check that record against the same record on other replicas. If any are out
of date, a read repairis then performed to sync them all to the most recent value.
ONE
Query all nodes. Once a majority of replicas (( replication factor / 2) + 1) respond, return to
the client the value with the most recent timestamp. Then, if necessary, perform a read repair in
the background on all remaining replicas.
QUORUM
Query all nodes. Wait for all nodes to respond, and return to the client the record with the most
recent timestamp. Then, if necessary, perform a read repair in the background. If any nodes fail
to respond, fail the read operation.
ALL
As you can see from the table, there are certain consistency levels that are not supported for read
operations: ZERO and ANY . Notice that the implication of consistency level ONE is that the first
node to respond to the read operation is the value that the client will get—evenifitisoutofdate.
The read repair operation is performed afterthe record is returned, so any subsequent reads will
all have a consistent value, regardless of the responding node.
Another item worth noting is in the case of consistency level ALL . If you specify CL.ALL , then
you're saying that you require all replicas to respond, so if any node with that record is down or
otherwise fails to respond before the timeout, the read operation fails.
NOTE
A node is considered unresponsive if it does not respond to a query before the value specified by
rpc_timeout_in_ms in the configuration file. The default is 10 seconds.
You can specify these consistency levels for write operations as well, though their meanings are
very different. The implications of using the different consistency levels on writes are shown in
Table 7-2 .
Search WWH ::




Custom Search