From 97bf563b7ec30fed5a1158d815a352b0fbd75a55 Mon Sep 17 00:00:00 2001 From: Adam Holmberg Date: Fri, 9 Oct 2015 13:03:14 -0500 Subject: [PATCH] default CL is now LOCAL_QUORUM PYTHON-416 --- cassandra/cluster.py | 6 +++++- docs/api/cassandra/cluster.rst | 3 +++ docs/getting_started.rst | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cassandra/cluster.py b/cassandra/cluster.py index 0f3a554f..555acd0c 100644 --- a/cassandra/cluster.py +++ b/cassandra/cluster.py @@ -1474,13 +1474,17 @@ class Session(object): .. versionadded:: 2.0.0 """ - default_consistency_level = ConsistencyLevel.ONE + default_consistency_level = ConsistencyLevel.LOCAL_QUORUM """ The default :class:`~ConsistencyLevel` for operations executed through this session. This default may be overridden by setting the :attr:`~.Statement.consistency_level` on individual statements. .. versionadded:: 1.2.0 + + .. versionchanged:: 3.0.0 + + default changed from ONE to LOCAL_QUORUM """ max_trace_wait = 2.0 diff --git a/docs/api/cassandra/cluster.rst b/docs/api/cassandra/cluster.rst index 1ccd9282..ead6457d 100644 --- a/docs/api/cassandra/cluster.rst +++ b/docs/api/cassandra/cluster.rst @@ -98,6 +98,9 @@ .. autoattribute:: default_timeout + .. autoattribute:: default_consistency_level + :annotation: = LOCAL_QUORUM + .. autoattribute:: row_factory .. autoattribute:: default_fetch_size diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 9e4384ce..2920b9ef 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -327,8 +327,12 @@ The consistency level used for a query determines how many of the replicas of the data you are interacting with need to respond for the query to be considered a success. -By default, :attr:`.ConsistencyLevel.ONE` will be used for all queries. To -specify a different consistency level, you will need to wrap your queries +By default, :attr:`.ConsistencyLevel.LOCAL_QUORUM` will be used for all queries. +This is to provide unsurprising default behavior with respect to read-after-write +consistency. However, many applications will prefer :attr:`.ConsistencyLevel.ONE` +to maximize performance and availability. +You can specify a different default for the session on :attr:`.Session.default_consistency_level`. +To specify a different consistency level per request, you will need to wrap your queries in a :class:`~.SimpleStatement`: .. code-block:: python