changeset 21740:3ce8158b7fd5

cassandra: Treat CASS_ERROR_SERVER_UNAVAILABLE as "write success is uncertain" Looks like the write could still have actually gone through.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 13 Mar 2017 22:52:41 +0200
parents 69f17440719c
children ad2aa897a8d7
files src/lib-sql/driver-cassandra.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-sql/driver-cassandra.c	Thu Mar 16 01:22:09 2017 +0200
+++ b/src/lib-sql/driver-cassandra.c	Mon Mar 13 22:52:41 2017 +0200
@@ -824,7 +824,11 @@
 
 		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;
@@ -832,7 +836,8 @@
 			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