Elffuss BraidHub

kikocis/java-driver public

Try next host when we get a SERVER_ERROR (JAVA-426).
Changeset597fa42e6e241cef065ff5444205af537f21bc780594c3b0123b0c36fa0a98c1
Authorolim7t <omichallat+github@gmail.com> · 2014-09-17 18:26 -07:00
Committerolim7t <omichallat+github@gmail.com> · 2014-09-23 11:35 +02:00
Parents46e39b8b4a39

Browse the files at this changeset

2 files changed

modified driver-core/CHANGELOG.rst +1 −0
@@ -7,6 +7,7 @@
77 - [bug] Handle null pool in PooledConnection.release (JAVA-449)
88 - [bug] Prevent concurrent retries of the same query (JAVA-449)
99 - [improvement] Defunct connection on request timeout (JAVA-425)
10+- [improvement] Try next host when we get a SERVER_ERROR (JAVA-426)
1011
1112
1213 2.0.6:
modified driver-core/src/main/java/com/datastax/driver/core/RequestHandler.java +10 −0
@@ -349,6 +349,16 @@
349349 metrics().getErrorMetrics().getOthers().inc();
350350 retry(false, null);
351351 return;
352+ case SERVER_ERROR:
353+ // Defunct connection and try another node
354+ logger.warn("{} replied with server error ({}), trying next host.", connection.address, err.message);
355+ DriverException exception = new DriverException("Host replied with server error: " + err.message);
356+ logError(connection.address, exception);
357+ connection.defunct(exception);
358+ if (metricsEnabled())
359+ metrics().getErrorMetrics().getOthers().inc();
360+ retry(false, null);
361+ return;
352362 case IS_BOOTSTRAPPING:
353363 // Try another node
354364 logger.error("Query sent to {} but it is bootstrapping. This shouldn't happen but trying next host.", connection.address);