From: Timo Sirainen Date: Sat, 11 Jun 2016 14:13:12 +0000 (+0300) Subject: cassandra: Try fallback_consistency also for write timeout failures. X-Git-Tag: 2.2.25.rc1~164 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5aa66452ffd9797e9da31b2741ad68d4a9dfab15;p=thirdparty%2Fdovecot%2Fcore.git cassandra: Try fallback_consistency also for write timeout failures. --- diff --git a/src/lib-sql/driver-cassandra.c b/src/lib-sql/driver-cassandra.c index 05cd3d9759..78595ceb83 100644 --- a/src/lib-sql/driver-cassandra.c +++ b/src/lib-sql/driver-cassandra.c @@ -707,7 +707,16 @@ static void query_callback(CassFuture *future, void *context) result->error = i_strdup_printf("Query '%s' failed: %.*s", result->query, (int)errsize, errmsg); - if (error == CASS_ERROR_SERVER_UNAVAILABLE && + /* unavailable = cassandra server knows that there aren't + enough nodes available. + + write timeout = cassandra server couldn't reach all the + needed nodes. this may be because it hasn't yet detected + that the servers are down, or because the servers are just + too busy. we'll try the fallback consistency to avoid + unnecessary temporary errors. */ + if ((error == CASS_ERROR_SERVER_UNAVAILABLE || + error == CASS_ERROR_SERVER_WRITE_TIMEOUT) && result->fallback_consistency != result->consistency) { /* retry with fallback consistency */ query_resend_with_fallback(result);