]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
cassandra: Treat CASS_ERROR_SERVER_UNAVAILABLE as "write success is uncertain"
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 13 Mar 2017 20:52:41 +0000 (22:52 +0200)
committerGitLab <gitlab@git.dovecot.net>
Thu, 16 Mar 2017 06:45:10 +0000 (08:45 +0200)
Looks like the write could still have actually gone through.

src/lib-sql/driver-cassandra.c

index 1a9f38f323e7f14f5967b776b12cb5fb980b6585..9c9372896c752c75322d186c477f6f471a29686b 100644 (file)
@@ -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