From: Timo Sirainen Date: Mon, 13 Mar 2017 20:52:41 +0000 (+0200) Subject: cassandra: Treat CASS_ERROR_SERVER_UNAVAILABLE as "write success is uncertain" X-Git-Tag: 2.3.0.rc1~1943 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0098ac3b6dcd8ef6ac20f87a8285da201db75a01;p=thirdparty%2Fdovecot%2Fcore.git cassandra: Treat CASS_ERROR_SERVER_UNAVAILABLE as "write success is uncertain" Looks like the write could still have actually gone through. --- diff --git a/src/lib-sql/driver-cassandra.c b/src/lib-sql/driver-cassandra.c index 1a9f38f323..9c9372896c 100644 --- a/src/lib-sql/driver-cassandra.c +++ b/src/lib-sql/driver-cassandra.c @@ -829,7 +829,11 @@ static void query_callback(CassFuture *future, void *context) msecs = timeval_diff_msecs(&ioloop_timeval, &result->start_time); counters_inc_error(db, error); + /* Timeouts bring uncertainty whether the query succeeded or + not. Also _SERVER_UNAVAILABLE could have actually written + enough copies of the data for the query to succeed. */ result->api.error_type = error == CASS_ERROR_SERVER_WRITE_TIMEOUT || + error == CASS_ERROR_SERVER_UNAVAILABLE || error == CASS_ERROR_LIB_REQUEST_TIMED_OUT ? SQL_RESULT_ERROR_TYPE_WRITE_UNCERTAIN : SQL_RESULT_ERROR_TYPE_UNKNOWN; @@ -837,7 +841,8 @@ static void query_callback(CassFuture *future, void *context) result->query, (int)errsize, errmsg, msecs/1000, msecs%1000); /* unavailable = cassandra server knows that there aren't - enough nodes available. + enough nodes available. "All hosts in current policy + attempted and were either unavailable or failed" write timeout = cassandra server couldn't reach all the needed nodes. this may be because it hasn't yet detected