Skip to content

Commit

Permalink
cassandra: Try fallback_consistency also for write timeout failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Jun 11, 2016
1 parent 8266226 commit 2522acb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/lib-sql/driver-cassandra.c
Expand Up @@ -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);
Expand Down

0 comments on commit 2522acb

Please sign in to comment.