Problem
Connection.setKeyspace handles ConnectionException before OperationTimedOutException:
|
} catch (ExecutionException e) { |
|
Throwable cause = e.getCause(); |
|
if (cause instanceof BusyConnectionException) { |
|
throw keyspaceBusyException(); |
|
} else if (cause instanceof QueryValidationException) { |
|
throw (QueryValidationException) cause; |
|
} else if (cause instanceof ConnectionException) { |
|
throw defunct((ConnectionException) cause); |
|
} else if (cause instanceof OperationTimedOutException) { |
|
// Rethrow so that the caller doesn't try to use the connection, but do not defunct as we |
|
// don't want to mark down |
|
logger.warn( |
|
"Timeout while setting keyspace on {}. " |
|
+ "This should not happen but is not critical (it will be retried)", |
|
this); |
|
throw new ConnectionException(endPoint, "Timeout while setting keyspace on connection"); |
OperationTimedOutException extends ConnectionException:
|
public class OperationTimedOutException extends ConnectionException { |
The timeout branch is unreachable. A transient keyspace setup timeout defuncts the connection and signals host conviction, contrary to the intended handling.
Fix
Check OperationTimedOutException before generic ConnectionException. Add synchronous setKeyspace coverage asserting the connection remains usable.
Regression from #942.
Problem
Connection.setKeyspacehandlesConnectionExceptionbeforeOperationTimedOutException:java-driver/driver-core/src/main/java/com/datastax/driver/core/Connection.java
Lines 888 to 903 in 46993c7
OperationTimedOutExceptionextendsConnectionException:java-driver/driver-core/src/main/java/com/datastax/driver/core/exceptions/OperationTimedOutException.java
Line 31 in 46993c7
The timeout branch is unreachable. A transient keyspace setup timeout defuncts the connection and signals host conviction, contrary to the intended handling.
Fix
Check
OperationTimedOutExceptionbefore genericConnectionException. Add synchronoussetKeyspacecoverage asserting the connection remains usable.Regression from #942.