Mercurial > dovecot > core-2.2
changeset 22961:34315e5fd52e
cassandra: Use fallback_consistency on more types of errors
This could allow for example read_consistency=local-quorum with
read_fallback_consistency=quorum, so most of the time the reads are
from local datacenter, but in case it has problems you can switch to
other datacenters.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 03 May 2018 17:06:04 +0300 |
parents | f10330f73af6 |
children | a58d4fd9e20d |
files | src/lib-sql/driver-cassandra.c |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-sql/driver-cassandra.c Thu May 03 16:58:21 2018 +0300 +++ b/src/lib-sql/driver-cassandra.c Thu May 03 17:06:04 2018 +0300 @@ -911,11 +911,25 @@ static bool query_error_want_fallback(CassError error) { switch (error) { + case CASS_ERROR_LIB_WRITE_ERROR: + case CASS_ERROR_LIB_REQUEST_TIMED_OUT: + /* Communication problems on client side. Maybe it will work + with fallback consistency? */ + return TRUE; case CASS_ERROR_LIB_NO_HOSTS_AVAILABLE: /* The client library couldn't connect to enough Cassandra nodes. The error message text is the same as for CASS_ERROR_SERVER_UNAVAILABLE. */ return TRUE; + case CASS_ERROR_SERVER_SERVER_ERROR: + case CASS_ERROR_SERVER_OVERLOADED: + case CASS_ERROR_SERVER_IS_BOOTSTRAPPING: + case CASS_ERROR_SERVER_READ_TIMEOUT: + case CASS_ERROR_SERVER_READ_FAILURE: + case CASS_ERROR_SERVER_WRITE_FAILURE: + /* Servers are having trouble. Maybe with fallback consistency + we can reach non-troubled servers? */ + return TRUE; case CASS_ERROR_SERVER_UNAVAILABLE: /* Cassandra server knows that there aren't enough nodes available. "All hosts in current policy attempted and were