# HG changeset patch # User Timo Sirainen # Date 1525356364 -10800 # Node ID 34315e5fd52ee4e5f7a932e14c0da968fd29cc76 # Parent f10330f73af60c2cb3f379c0b0f1f4f5c0a530e5 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. diff -r f10330f73af6 -r 34315e5fd52e src/lib-sql/driver-cassandra.c --- 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