]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
cassandra: Try fallback_consistency also for write timeout failures.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 11 Jun 2016 14:13:12 +0000 (17:13 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 14 Jun 2016 09:25:02 +0000 (12:25 +0300)
src/lib-sql/driver-cassandra.c

index 05cd3d9759225df8978bc71cf3473ebe390fa486..78595ceb834b245b5ca9f23d70a8b8138c6689fd 100644 (file)
@@ -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);